vuepress文章内有模板语法时编译报错的解决
文章发布较早,内容可能过时,阅读注意甄别。
之前想要发布一篇 go 模板语法的文章,总是编译失败,今天又一次发布类似的文章,发现总是编译失败。
查了一下,发现有人提过这个问题 (opens new window),解决方案在:使用v-pre (opens new window)。
记录报错内容:
@ ./docs/03.闲言碎语/12.效率工具/05.Mac时代/08.我的Obsidian入门之旅(其三之插件折腾).md?vue&type=template&id=7b47ffa0& 1:0-540 1:0-540
@ ./docs/03.闲言碎语/12.效率工具/05.Mac时代/08.我的Obsidian入门之旅(其三之插件折腾).md
@ ./node_modules/@vuepress/core/.temp/internal/page-components.js
@ ./node_modules/@vuepress/core/lib/client/util.js
@ ./node_modules/@vuepress/core/lib/client/app.js
@ ./node_modules/@vuepress/core/lib/client/serverEntry.js
@ multi ./node_modules/@vuepress/core/lib/client/serverEntry.js
Error: Failed to compile with errors.
at /data/project/wiki/eryajf.github.io-main/node_modules/@vuepress/core/lib/node/build/index.js:180:16
at finalCallback (/data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/MultiCompiler.js:254:12)
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/MultiCompiler.js:277:6
at done (/data/project/wiki/eryajf.github.io-main/node_modules/neo-async/async.js:2931:13)
at runCompilers (/data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/MultiCompiler.js:181:48)
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/MultiCompiler.js:188:7
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/MultiCompiler.js:270:7
at finalCallback (/data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/Compiler.js:257:39)
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/Compiler.js:273:13
at AsyncSeriesHook.eval [as callAsync] (eval at create (/data/project/wiki/eryajf.github.io-main/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
at AsyncSeriesHook.lazyCompileHook (/data/project/wiki/eryajf.github.io-main/node_modules/tapable/lib/Hook.js:154:20)
at onCompiled (/data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/Compiler.js:271:21)
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/Compiler.js:681:15
at AsyncSeriesHook.eval [as callAsync] (eval at create (/data/project/wiki/eryajf.github.io-main/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
at AsyncSeriesHook.lazyCompileHook (/data/project/wiki/eryajf.github.io-main/node_modules/tapable/lib/Hook.js:154:20)
at /data/project/wiki/eryajf.github.io-main/node_modules/webpack/lib/Compiler.js:678:31
error Command failed with exit code 1.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
解决方案如下:
::: v-pre
`{{ This will be displayed as-is }}`
:::
1
2
3
2
3
使用v-pre
包裹想要展示的内容。
上次更新: 2024/11/19, 23:11:42