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

Template values in yaml must be escaped #5

Open
nandenjin opened this issue Sep 30, 2020 · 0 comments · May be fixed by #6
Open

Template values in yaml must be escaped #5

nandenjin opened this issue Sep 30, 2020 · 0 comments · May be fixed by #6

Comments

@nandenjin
Copy link

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.

@nandenjin nandenjin changed the title Template values in yaml are must be escaped Template values in yaml must be escaped Sep 30, 2020
@nandenjin nandenjin linked a pull request Sep 30, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant