vitepress
vitepress copied to clipboard
SyntaxError: Element is missing end tag.
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
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
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.
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.
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.