Skip to content

Missing Support for Python Console Output and Doctests #549

@mattharrison

Description

@mattharrison

Description:
Syntect currently lacks support for highlighting Python console output (characterized by >>> and ... prompts) and doctests. This limitation hinders its ability to accurately represent Python code in various contexts, including code examples, tutorials, and interactive sessions.

Expected Behavior:
Syntect should correctly highlight the Python code while ignoring the >>>, ..., and output (stacktrace or stdout).

Steps to Reproduce:

  1. Create a code snippet containing Python console output or a doctest:

    >>> print("Hello, world!")
    Hello, world!

Note this language is commonly called pycon (for python console), and tools like Pygments or Github markdown support this language (as evidenced by highlighting the above code).

(My desire is because I'm exploring Typst and want like to port my books from LaTeX to Typst. See this bug typst/typst#4661 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions