vuejs / vitepress

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

[plugin:vite:vue] Element is missing end tag #4031

Open Uxspy opened 4 months ago

Uxspy commented 4 months ago

Describe the bug

I'm using html in .md files, if the html content is similar like the following, vitepress(run dev or run build) report "Element is missing end tag"

... <pre data-language="javascript" id="PZrJj" class="ne-codeblock language-javascript"><code>const foo = 'foo'

function bar() {
  const b = 'b'
  return b
}

</code></pre> ...

Everything works well after I removed all the line-breaks(\r\n) inside the <code></code> tag, like this:

...<pre data-language="javascript" id="PZrJj" class="ne-codeblock language-javascript"><code>const foo = 'foo'
function bar() {
  const b = 'b'
  return b
}
</code></pre>...

Reproduction

👆🏻

Expected behavior

Expect works when using

...
 in .md files with line-breaks

System Info

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 91.86 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 14.21.3 - ~/.nvm/versions/node/v14.21.3/bin/node
  Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.3/bin/yarn
  npm: 6.14.18 - ~/.nvm/versions/node/v14.21.3/bin/npm
Browsers:
  Chrome: 126.0.6478.127
  Edge: 126.0.2592.87
  Safari: 17.5

Additional context

No response

Validations

brc-dd commented 4 months ago

Please provide a minimal reproducible example. That code is working fine - https://stackblitz.com/edit/vite-dejjqk?file=docs%2Findex.md