You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the markdown source contains an inline HTML comment which contains a markdown link whose text contains markdown formatting, the resulting HTML contains the placeholder for the formatted text.
>>>markdown.markdown("For example <!-- [**Bold link**](http://example.com) -->")
'<p>For example <!-- <a href="http://example.com">\x02klzzwxh:0000\x03</a> --></p>'
This is similar to #42, but only occurs when there is formatting in the link text.
Also notable is that this behavior for comments only occurs when the comment does not start a line — HTML comments at the start of a line are not processed for markdown syntax at all.
Sigh. I can confirm. We have another weird edge case. This is different from the block-level raw HTML case because Markdown requires block level parsing only when the block starts at the beginning of the line. In other words, the HTML comment is parsed as in-line HTML, which takes a different code path. It also means that Markdown parsing happens inside the comment.
I believe the issue is that we are only escaping one level but we have a placeholder inside a placeholder. Therefore, we need to unescaped until there are no more placeholders.
Activity
waylan commentedon Dec 1, 2025
Sigh. I can confirm. We have another weird edge case. This is different from the block-level raw HTML case because Markdown requires block level parsing only when the block starts at the beginning of the line. In other words, the HTML comment is parsed as in-line HTML, which takes a different code path. It also means that Markdown parsing happens inside the comment.
waylan commentedon Dec 1, 2025
I believe the issue is that we are only escaping one level but we have a placeholder inside a placeholder. Therefore, we need to unescaped until there are no more placeholders.
https://github.com/Python-Markdown/markdown/blob/master/markdown/inlinepatterns.py#L511-L527
Ensure nested elements inside inline comments are properly unescaped.
Ensure nested elements inside inline comments are properly unescaped.
chore(deps): update dependency markdown to v3.10.1 (#246)