-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Definition lists: HTML comment edge case #7778
Comments
for what it's worth, the following works:
not sure this is a bug... just an edge case in the pandoc's markdown syntax... |
@mb21 your suggested workaround is not feasible for larger comments b/c any line starting with |
FWIW, multimarkdown and kramdown give the same result as pandoc. Pandoc's CommonMark parser, with the |
This happens because the way the def list parser works is by gobbling up raw lines comprising the definition, and then parsing after the fact. This method isn't sophisticated enough to skip a multiline HTML comment. Here's another case worth considering.
Note that this case is parsed by the commonmark+definition_list parser as
which is correct given the commonmark principle that block-level structure takes precedence over inline-level structure. |
This doesn't just happen with HTML comments. It can also occur with other inline elements like inline code. The output makes sense based on the parsing algorithm, but it is somewhat surprising from a user perspective to discover that the validity of inline code depends on line break locations. Here's an example with inline code:
Pandoc Markdown produces this:
And CommonMark ( |
If you indent your definitions properly, you're less likely to run into problems like this:
versus
|
I am very thankful for Pandoc and its contributors. So, please excuse me asking for a clarification why in this case it is acceptable that an HTML comment of type |
I don't think the issue should have been closed. |
Same here with list: * foo
<!--
* bar
-->
* baz
* baz
<!--
* qux
-->
* end $ pandoc --from markdown --to html5 list-with-comment.md
<ul>
<li>foo <!--
* bar
--></li>
<li>baz
<ul>
<li>baz <!–</li>
</ul></li>
<li>qux –></li>
<li>end</li>
</ul> |
In the following minimal example the HTML comment
<!-- (…) -->
is falsely not recognized as a comment:Pandoc v2.16.2 with
pandoc --from markdown --to html5
producespandoc --strip-comments
produces the same output as above. A workaround is to put any character in front of the commented:
. In other words, the commented:
(or a~
) is what triggers the bug.The text was updated successfully, but these errors were encountered: