Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Support for Python Console Output and Doctests #549

Open
mattharrison opened this issue Aug 9, 2024 · 3 comments
Open

Missing Support for Python Console Output and Doctests #549

mattharrison opened this issue Aug 9, 2024 · 3 comments

Comments

@mattharrison
Copy link

mattharrison commented Aug 9, 2024

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 )

@keith-hall
Copy link
Collaborator

keith-hall commented Aug 10, 2024

I don't know of any sublime-syntax files which can currently highlight doctests correctly. Theoretically if we were to create one, it would be a lot easier to extend the base Python sublime-syntax to add support for it, so probably we'd need to wait for #536 to be merged first

Related: #168

@mattharrison
Copy link
Author

mattharrison commented Aug 10, 2024 via email

@keith-hall
Copy link
Collaborator

Mainly in the Packages folder/submodule of the testdata folder: https://github.com/trishume/syntect/tree/master/testdata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants