Skip to content

Escaped $ in math incorrectly parsed #370

Closed

Description

@nschloe

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': '$'}
        ]
    }
]

Activity

  1. changed the title [-]Escaped math incorrectly parsed[/-] [+]Escaped `$` in math incorrectly parsed[/+] on Nov 21, 2023
  2. added this to the Version 3.2 milestone on Aug 29, 2025
  3. added a commit that references this issue on Mar 17, 2026
    7bd5709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions