lepture/mistune

Inline math incorrectly removes newlines

Opened this issue · 0 comments

MWE:

import mistune
from rich import print

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

tokens = markdown("$`a+%\nb`$")

print(tokens)

Output:

[
    {
        'type': 'paragraph',
        'children': [
            {'type': 'text', 'raw': '$'},
            {'type': 'codespan', 'raw': 'a+% b'},
            {'type': 'text', 'raw': '$'}
        ]
    }
]