Make code role highlighting consistent with code-block directive

Fixes https://github.com/sphinx-doc/sphinx/issues/5157

This is factored out of the sphinx-immaterial theme:
1ef121a612/sphinx_immaterial/inlinesyntaxhighlight.py (L1)

See also:
https://github.com/sphinx-doc/sphinx/pull/6916
This commit is contained in:
Jeremy Maitin-Shepard
2022-03-10 19:33:56 -08:00
parent b3812f72a9
commit 099b54cb87
10 changed files with 200 additions and 5 deletions

View File

View File

@@ -0,0 +1,9 @@
.. role:: python(code)
:language: python
:class: highlight
Inline :python:`def foo(1 + 2 + None + "abc"): pass` code block
.. code-block:: python
def foo(1 + 2 + None + "abc"): pass