-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
gh-126882: Fix indentation in code sample block. #126887
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Thanks! There's a couple more code blocks in the file that should be fixed as well |
…s from all other code blocks.
I changed the language type from pycon to python and got rid of the leading spaces in all of the code blocks in this document. One of the code blocks that I missed in my first commit has line-comments inserted between lines of the REPL session. Using pycon wouldn't highlight these comments because their lines don't start with >>>. Adding the >>> in front of every comment would correct the syntax, and enable comment highlighting, but it gets a bit messy. Just changing the language type to python provides the expected syntax-highlighting, and allows the author a little license to stray from strict representation of an actual REPL session. |
… markers ('>>> ' and '... '), and adjust comments for correct syntax in a repl session.
@javert42, please avoid using "update branch" button without a good reason. Obviously, it can be used to trigger CI run, or when you resolve merge conflicts. |
Sorry about that. I had read that documentation, but I thought the update was necessary to unblock the merge. It sounds like I'm not involved in anything beyond this point (assuming no addition change requests or merge conflicts). Thanks for all your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @javert42!
Both code blocks are text from a Python REPL session. pycon is an alias for the Python REPL language used for syntax highlighting. The problem is that the lines all begin with unnecessary spaces, while pycon expects each line of input to begin with '^>>>' or '^...' (see link below).
Changing the language type to python would also work, but pycon seems to be appropriate for this case (after getting rid of the leading spaces).
This change keeps the language type (pycon) and removes the leading spaces.
Notes:
I believe this is what is being used for syntax highlighting in both GitHub and VS Code:
https://github.com/highlightjs/highlight.js/blob/c49081a84fc5de213383287b68ce2ecc238e537d/src/languages/python-repl.js
garbage_collector.md
to improve syntax highlighting #126882