-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Roles/styles for good/bad code blocks in PEPs #22
Comments
This would be reasonably easy with
& similar for good -- it is then just a stylesheet change. We could add A |
I don't know much about where it should be discussed -- perhaps Discourse would be better. |
Sounds like a great change to me, and @AA-Turner 's approach makes sense—so long as there is a way to clearly communicate to doc writers how and when they should use it (or is this just for PEPs?) Also, @AA-Turner , any reason to prefer |
They're aliases, so there isn't any functional difference between the two. |
Hmm, well then if that's the case, the Sphinx and the Docutils documentation should be updated, then—Docutils only lists If we instead defer this to after if/when PEP 676 is adopted, as @encukou suggests and we seem to agree on, we can use the modern Sphinx semantics with |
Oh, wait, I'm wrong! And, you are absolutely correct.
|
I personally think using |
Will update when on PC. A |
Indeed! There's an
I should've looked closer. I guess my 20-ish year old brain's memory isn't completely trash yet. :) Sphinx also has a |
So... final update:
|
I'm assuming you mean But otherwise, 👍 to the above. |
It does have that tho. https://github.com/sphinx-doc/sphinx/blob/a55a765e797197cfdf8a3e5033efe8ed72191a62/sphinx/directives/code.py#L114 Also, I'm not really sure why you consider passing an option to a directive to be "legacy" -- could you elaborate on why you think that's "legacy"? |
Hmm, well upon further testing it does appear to work (I somehow missed seeing the class on the outer div), but it appears to be undocumented (despite
Its not that passing an option to a directive in the general case is "legacy", but rather this specific case of a bespoke |
generally with reST you can pass A |
FWIW, a devguide page now uses emoji directly: |
PEP 676 has landed, please see PR python/peps#3567 to add green/red borders to the left of good/bad code examples of PEP 8. We can add them to other PEPs afterwards. |
For the examples of good/bad commits in the devguide: python/devguide#1237 |
python/devguide#1237 has been merged to add the CSS classes and apply them to PEP 8.
Please see python/peps#3574 to add a red sidebar here. We can close this issue now the CSS is available, we can add to other PEPs as and when. 🚀 |
Do we want to add styling for good/bad code blocks to PEPs?
For an epxample, look at pep8.org, a third-party (and outdated) rendering of PEP 8
The main difference between it and the new style proposed for PEPs is the red & green indicators on what to do vs. what not to do.
I've just read the dangerous "naive" SQL code in PEP-0675 and thought it could use a similar "don't copy this" indicator. There surely are many other examples.
Of course everything should be covered in prose for screen readers and color-blind people, but for many people colors could aid understanding.
Would it be useful in docs as well?
The text was updated successfully, but these errors were encountered: