-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
PEP 8: Add green and red sidbar for good and bad examples #3567
Conversation
Nice. I suspect this annotation can be put to use in quite a few places elsewhere too. Excellent enhancement IMO. |
Would look like this: And give us extra green in places like: |
Thank you! This looks useful for me as for a non-colourblind reader. I'm sure it could be made more accessible, perhaps in a dedicated PR.
It does look better to me :) IMO, in that case the outdated |
Leave the multiple-with-statement-and-backslashes example uncoloured, it's for pre-3.10
Thanks, I've updated this PR to add those extra ones.
Good point, I've left this one uncoloured: https://pep-previews--3567.org.readthedocs.build/pep-0008/#maximum-line-length |
What about a yellow border for examples like this? The diff is a little difficult to read, but I'll trust that there aren't any content changes. The red/green borders are very nice! Thanks for doing this. |
Something like this? https://pep-previews--3567.org.readthedocs.build/pep-0008/#maximum-line-length
Correct, no content changes. Sphinx is stricter for |
Re: yellow - yes, exactly. It looks pretty good in both light and dark themes. Thanks! |
Thanks for the reviews! Let's merge this, and we can then add to other PEPs where appropriate. |
As suggested in python/docs-community#22.
Like https://pep8.org, add green and red borders on the left side of "good" and "bad" code examples.
For example:
(This PR also removes redundant
Version
,Last-Modified
andContent-Type
headers, andLocal Variables:
footer.)Accessibility check: colourblindness
We are not relying on colour to convey information; as before, the info about whether examples are good or bad is conveyed via the text.
We can later apply this to other good/bad code examples in other PEPs, such as the dangerous SQL code in PEP 675.
Question
I only added green/red for examples that are comparatively marked as correct or wrong (or similar). I left the other examples unmarked. But I think we could also mark those green, because they too are examples of good/allowed style. Thoughts?
📚 Documentation preview 📚: https://pep-previews--3567.org.readthedocs.build/pep-0008/