YMFE/ydoc

编译index.jsx报错

fengxinming opened this issue · 1 comments

YDoc 版本号:

4.1.0

环境(操作系统、Node 版本、浏览器版本等信息):

MacOS Mojave 10.14.5

复现步骤:

修改index.jsx,在desc里面写入转义符和单引号\', 然后build的时候就报错

期望结果:

正常编译成html,建议直接支持json格式,或者支持pug模版。另外上次你回复的那种方法不能修改搜索框里面的中文占位符。

补充说明:

error: { YAMLException: missed comma between flow collection entries at line 10, column 38:
     ...  name: 'Modular', desc: 'celia\'s modular methods are great for  ... 
                                         ^
    at generateError (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:167:10)
    at throwError (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:173:9)
    at readFlowCollection (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:718:7)
    at composeNode (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1360:11)
    at readBlockMapping (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1036:16)
    at composeNode (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1359:12)
    at readBlockSequence (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:955:5)
    at composeNode (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1358:12)
    at readBlockMapping (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1089:11)
    at composeNode (/Users/jesse/.nvm/versions/node/v8.16.0/lib/node_modules/ydoc/node_modules/_js-yaml@3.13.1@js-yaml/lib/js-yaml/loader.js:1359:12)
  name: 'YAMLException',
  reason: 'missed comma between flow collection entries',

参见 阮一峰的 YAML 语言教程:

单引号和双引号都可以使用,双引号不会对特殊字符转义。
s1: '内容\n字符串'
s2: "内容\n字符串"

因此使用双引号嵌套单引号即可,无需转义:

desc: "基于 'markdown 轻松生成完整静态站点"