vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.17k stars 2.12k forks source link

render error with toc and escapse <tag> #605

Closed wgf4242 closed 2 years ago

wgf4242 commented 2 years ago

Describe the bug

Rendered error with toc in headline.

index.md

[[toc]]

### `<path>`

Reproduction

https://stackblitz.com/edit/github-zbjrsg-7dahpw?file=index.md

Expected behavior

      at createCompilerError (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:19:19)
      at emitError (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1594:29)
      at parseElement (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1146:9)
      at parseChildren (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:937:28)
      at parseElement (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1125:22)
      at parseChildren (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:937:28)
      at parseElement (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1125:22)
      at parseChildren (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:937:28)
      at parseElement (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1125:22)
      at parseChildren (D:\wgf\My Documents\GitHub\vueprojects\vitepress_demo\node_modules\.pnpm\@vue+compiler-core@3.2.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:937:28)

System Info

....

Additional context

No response

Validations

brc-dd commented 2 years ago

Removing this line should fix this:

https://github.com/vuejs/vitepress/blob/bae47f708264722a92f8feeb7a8f3fbecc756196/src/node/markdown/markdown.ts#L93

But I am unsure why it was added in first place. It was ported from VuePress.

Edit: Just tested. It does everything same as the default formatter except for parsing emojis. Let it remain there, and simply encode the resultant string.

kiaking commented 2 years ago

Done!