Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.
This repository was archived by the owner on May 13, 2024. It is now read-only.

Template values in yaml must be escaped #5

Open
@nandenjin

Description

@nandenjin

How to repro

Input value contains : as description in setup

Result

It makes this:

// docs/src/index.md
---
home: true
heroImage: https://v1.vuepress.vuejs.org/hero.png
tagline: The Moon: the only satellite of our home planet
actionText: Quick Start →
actionLink: /guide/
features:
- title: Feature 1 Title
  details: Feature 1 Description
- title: Feature 2 Title
  details: Feature 2 Description
- title: Feature 3 Title
  details: Feature 3 Description
footer: Made by Kazumi Inada with ❤️
---

yarn dev returns following error:

YAMLException: incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line at line 4, column 17:
    tagline: The Moon: the only satellite of our home planet
                    ^
    at generateError (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
    at throwError (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
    at readBlockMapping (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1027:9)
    at composeNode (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)
    at readDocument (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1525:3)
    at loadDocuments (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5)
    at load (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19)
    at Object.safeLoad (/Users/nandenjin/workspace/sample-project/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10)
    at module.exports (/Users/nandenjin/workspace/sample-project/node_modules/gray-matter/lib/parse.js:12:17)
    at parseMatter (/Users/nandenjin/workspace/sample-project/node_modules/gray-matter/index.js:109:17)
    at Object.matter [as default] (/Users/nandenjin/workspace/sample-project/node_modules/gray-matter/index.js:50:10)
    at parseFrontmatter (/Users/nandenjin/workspace/sample-project/node_modules/@vuepress/shared-utils/lib/parseFrontmatter.js:8:33)
    at Page.process (/Users/nandenjin/workspace/sample-project/node_modules/@vuepress/core/lib/node/Page.js:106:44)
    at async App.addPage (/Users/nandenjin/workspace/sample-project/node_modules/@vuepress/core/lib/node/App.js:354:5)
    at async /Users/nandenjin/workspace/sample-project/node_modules/@vuepress/core/lib/node/App.js:339:7
    at async Promise.all (index 3)
error Command failed with exit code 1.

How to fix

Add escape step at templates contains YAML.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions