-
-
Notifications
You must be signed in to change notification settings - Fork 27
Fix syntax highlighting in README #12
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
Conversation
For some reason GH does not recognize `.. code-block: python3`, but `.. code-block: python` works even for Python 3 syntax.
Codecov Report
Merging #12 into master will not change coverage.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #12 +/- ## ===================================== Coverage 100% 100% ===================================== Files 7 7 Lines 776 776 Branches 59 59 ===================================== Hits 776 776
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update bd2868a...bb7929f. Read the comment docs.
Ugh. You're not wrong, but I bet this will break syntax highlighting on pypi, because pygments definitely treats python and python3 differently. Probably we should at least file bugs on GitHub and pygments asking them to fix their things.
I emailed support@github.com, and filed https://bitbucket.org/birkenfeld/pygments-main/issues/1415
I guess I'll give it a few days to see if either of them seems to be moving :-)
Thanks, sorry I forgot to get back at this myself. 👍
Pygments has separate highlighters for "python" (meaning python 2) and "python3" (meaning python 3). As a result, there are lots of files out there (especially ReSTructured text) that contain code blocks whose language is explicitly given as "python3" or "py3". Currently these are unrecognized by linguist. Instead, we should use our python highlighter for them (which works for both python 2 and python 3). References: http://pygments.org/docs/lexers/#pygments.lexers.python.Python3Lexer github/markup#1019 python-trio/async_generator#12
Pygments has separate highlighters for "python" (meaning python 2) and "python3" (meaning python 3). As a result, there are lots of files out there (especially ReSTructured text) that contain code blocks whose language is explicitly given as "python3" or "py3". Currently these are unrecognized by linguist. Instead, we should use our python highlighter for them (which works for both python 2 and python 3). References: http://pygments.org/docs/lexers/#pygments.lexers.python.Python3Lexer github/markup#1019 python-trio/async_generator#12
Github just added python3 as an alias for python in the library they use for syntax highlighting: github-linguist/linguist#4026
I'm not sure how long this will take to flow from "committed to the open source library" to "deployed on the production site" – possibly a few weeks.
But in any case I guess I'll close this, since the current solution works with pypi/sphinx and the github rendering will fix itself eventually, and in the mean time it's not too terrible. Thanks for bringing this up though :-)
Sure thing, thanks for the update!
For some reason GH does not recognize
.. code-block: python3, but.. code-block: pythonworks even for Python 3 syntax.