Closed yonecdeng closed 1 month ago
Not reproducible - https://stackblitz.com/edit/vite-f3sd6k?file=docs%2Findex.md
\ PS: It should be rendered to this:
<p>hello <picture>
<img src="https://github.com/markdown-it/markdown-it/assets/73653404/63aa836d-2541-40bb-a4be-aaf02495426d"/>
</picture></p>
With your markdown-it playground example it's reproducible if you remove extra spaces from front. But there too it's producing invalid html. In that case the error is correct.
<p>hello <picture></p>
<source type="image/avif" srcset="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp?imageMogr2/format/avif"/>
<img src="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp" alt="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp" loading="lazy"/>
</picture>
If you don't remove spaces, then it works fine in both markdown-it playground and vitepress:
With your markdown-it playground example it's reproducible if you remove extra spaces from front. But there too it's producing invalid html. In that case the error is correct.
<p>hello <picture></p> <source type="image/avif" srcset="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp?imageMogr2/format/avif"/> <img src="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp" alt="https://picbed-1306720359.cos.ap-guangzhou.myqcloud.com/upic/2024-02-07-17-37-OUE54Z.webp" loading="lazy"/> </picture>
If you don't remove spaces, then it works fine in both markdown-it playground and vitepress:
thanks for your reply. i do not understand why the error is correct.
I do not understand why the error is correct.
Notice the first line <p>hello <picture></p>
-- There is no closing tag for picture. (In other words, paragraph is closed before picture is closed.)
I do not understand why the error is correct.
Notice the first line
<p>hello <picture></p>
-- There is no closing tag for picture. (In other words, paragraph is closed before picture is closed.)
Haha I know. I probably didn't make my point clear, I was trying to say that converting into this <p>hello <picture></p>
shouldn't be right and why would it be converted to <p>hello <picture></p>
?
I'm not fully sure about that. But that's according to the CommonMark standard. We cannot adjust that here.
Describe the bug
The original md document:
After executing md.render it will be:
Reproduction
you can try this markdown content:
Expected behavior
I hope after executing md.render it should be:
System Info
Additional context
This seems to be caused by using some mdit plugin, because I tried it here and it converted correctly
Validations