lepture/mistune

Escaped `$` in math incorrectly parsed

Opened this issue · 0 comments

MWE:

import mistune
from rich import print

markdown = mistune.create_markdown(
    renderer="ast",
    plugins=["math"],
)


tokens = markdown(r"$x=\$$")

print(tokens)

Output:

[
    {
        'type': 'paragraph',
        'children': [
            {'type': 'inline_math', 'raw': 'x=\\'},
            {'type': 'text', 'raw': '$'}
        ]
    }
]