lepture/mistune

Certain characters in inline code incorrectly parsed (e.g., `&`)

Opened this issue · 1 comments

MWE:

import mistune
from mistune.core import BlockState
markdown = mistune.create_markdown(renderer="ast")

md = r"`&<>`"
tokens = markdown(md)

print(tokens)

Output:

[{'type': 'paragraph', 'children': [{'type': 'codespan', 'raw': '&amp;&lt;&gt;'}]}]

We also encountered this. The cause is 8452faf, more specifically this change, I think.
Putting HTML escaping into the parser stage, independently of the output format, is incorrect.