Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html comment after list causes all remaining content be commented out #3515

Closed
mjbvz opened this issue Oct 31, 2024 · 1 comment · Fixed by #3518
Closed

html comment after list causes all remaining content be commented out #3515

mjbvz opened this issue Oct 31, 2024 · 1 comment · Fixed by #3518
Labels
category: html blocks category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@mjbvz
Copy link

mjbvz commented Oct 31, 2024

Marked version: 14.1.3

Describe the bug
When a html comment appears directly after a list, the rest of the content can become incorrectly commented out

To Reproduce

Try rendering the markdown:

- list
<!--
- a
-->

More text

https://marked.js.org/demo/?text=-%20list%0A%3C!--%0A-%20a%0A--%3E%0A%0AMore%20text%0A&options=%7B%0A%20%22async%22%3A%20false%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22extensions%22%3A%20null%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22hooks%22%3A%20null%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22walkTokens%22%3A%20null%0A%7D&version=14.1.3

Expected behavior
The content after the comment is not shown. Looking at the html source, you can see that an unclosed comment is created which contains the rest of the document:

<ul>
<li>list<!--</li>
<li>a
--&gt;</li>
</ul>
<p>More text</p>

Seems to work on commonmark and for markdown-it

@UziTech
Copy link
Member

UziTech commented Oct 31, 2024

Looks like it is not ending the list at the comment. Well formatted markdown should have a blank line between block elements, which is displayed correctly. (demo)

@UziTech UziTech added L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue category: lists category: html blocks labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: html blocks category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants