-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is your feature request related to a problem? Please describe.
This PR on the repo for the packaging.python.org guide pypa/packaging.python.org#1428 reveals an easy-to-make mistake in Sphinx and similar tools:
.. code-block:: python
>>> some Python console session
where the lexer should be pycon instead.
This looks pretty common actually:
https://grep.app/search?q=%5C.%5C.%20code-block%3A%3A%20python%5Cn%5Cs%2A%3E%3E%3E®exp=true
https://grep.app/search?q=%60%60%60python%5Cn%3E%3E%3E®exp=true
Describe the solution you'd like
It would be nice if a warning could be emitted in that case at doc build.
Describe alternatives you've considered
The alternative I have found is manual check, helped by commands like:
grep -r 'code-block:: python' -A 3 .
Additional context
pypa/packaging.python.org#1428
started from a correction asked here: pypa/packaging.python.org#1424
From pypa/packaging.python.org#1428,
@jeanas reported the same problem but with a distinct solution here:
pygments/pygments#2603