Use tree-sitter highlighting for pycon (Python console) code blocks
#210376
Replies: 2 comments
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Summary of the IssueYou've identified an important feature request regarding syntax highlighting for The Problem
Why This Matters
The SolutionImplement tree-sitter-based syntax highlighting specifically for:
Technical NoteAs you correctly noted, this requires GitHub's implementation rather than Linguist's changes, since tree-sitter highlighting is managed by GitHub's rendering system. This is a valuable feature request that would significantly improve documentation readability without sacrificing testability. |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Product Feedback
💬 Feature/Topic Area
Other
Body
Use tree-sitter highlighting for
pycon(Python console) code blocksFenced code blocks tagged
pythonare highlighted with GitHub's tree-sitterhighlighter. Blocks tagged
pycon(Linguist's "Python console", scopetext.python.console) fall back to the MagicPython TextMate grammar. So thecode after
>>>and...prompts gets far less highlighting than the samecode in a
pythonblock: class names, calls, attributes and keywordarguments stay uncolored.
To reproduce, render this with
POST /markdown(modegfm), once taggedpyconand once taggedpythonwithout the prompt:The
pyconoutput only usespl-k,pl-sandpl-c1. Thepythonoutputalso uses
pl-en,pl-vandpl-s1. A full example is this README:https://github.com/clintval/bedspec/blob/3c768d2/README.md
pyconis the usual way to show Python examples with their output, and manyprojects test their READMEs as doctests. Right now authors have to choose
between examples that can be tested and readable highlighting.
Request: highlight the code lines of
pyconblocks (those after>>>and...) with the same tree-sitter Python highlighter used forpythonblocks,and leave output lines plain. Linguist maintainers have said tree-sitter
highlighting is managed by GitHub rather than Linguist
(github-linguist/linguist#7787).
All reactions