Skip to content

Conversation

@javert42
Copy link
Contributor

@javert42 javert42 commented Nov 15, 2024

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

@ghost
Copy link

ghost commented Nov 15, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Nov 15, 2024

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 skip news label instead.

@tomasr8
Copy link
Member

tomasr8 commented Nov 15, 2024

Thanks! There's a couple more code blocks in the file that should be fixed as well

@javert42
Copy link
Contributor Author

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.
@skirpichev
Copy link
Contributor

@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.

@javert42
Copy link
Contributor Author

@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.

Copy link
Member

@tomasr8 tomasr8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @javert42!

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AlexWaygood AlexWaygood changed the title gh-126882: Fix indentation in code sample block. gh-126882: Fix indentation in code sample block Nov 27, 2024
@AlexWaygood AlexWaygood enabled auto-merge (squash) November 27, 2024 15:20
@AlexWaygood AlexWaygood merged commit 14a05a8 into python:main Nov 27, 2024
26 of 27 checks passed
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants