vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

SyntaxError: Element is missing end tag.

Open luo772435545 opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug

vitepress dev is normal, but vitepress build reports an error, SyntaxError: Element is missing end tag. The key is that it is impossible to locate where the end tag is missing.

Reproduction

vitepress build

Expected behavior

Pack normally or provide specific error information

System Info

"vitepress": "^1.1.4"

Additional context

No response

Validations

luo772435545 avatar May 09 '24 09:05 luo772435545

provide specific error information

Will be fixed in next release.

vitepress dev is normal

It won't be. You likely haven't opened the right page.

You can do something like DEBUG='*' npm run docs:build and it will show you the last file where rendering failed.

brc-dd avatar May 09 '24 12:05 brc-dd

I haven't tested the DEBUG='*' npm run docs:build but it does say which file had the problem. But annoyingly it's not pointing to the right line. I don't know if it's because of the frontmatter offset or because it's simply hard to know where the </sometag> is missing.

peterbe avatar May 23 '24 14:05 peterbe

but it does say which file had the problem

Yeah it was added in recent releases.

But annoyingly it's not pointing to the right line

Unfortunately, that's not quite possible because markdown-it doesn't have an AST. We will need to use something like remark for sourcemaps support but it doesn't properly work with Vue.

brc-dd avatar May 23 '24 14:05 brc-dd