diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-02-09 22:25:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 22:25:02 +0900 |
commit | 1f1cd49f475bb11a5e79cee2df3ce792d9071c75 (patch) | |
tree | 677ce7933ae9828772940ae6bbc9305908c440bf | |
parent | 84458da82889e28fc44988601a79c0c562e0e994 (diff) | |
parent | 08c2c23bb4b0eb1c3b6a9a889ad488612c33d0e0 (diff) | |
download | sphinx-git-1f1cd49f475bb11a5e79cee2df3ce792d9071c75.tar.gz |
Merge pull request #8850 from DelazJ/patch-1
Make code block types more visible in documentation
-rw-r--r-- | doc/usage/restructuredtext/directives.rst | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/usage/restructuredtext/directives.rst b/doc/usage/restructuredtext/directives.rst index e8b88c21b..53625ac9e 100644 --- a/doc/usage/restructuredtext/directives.rst +++ b/doc/usage/restructuredtext/directives.rst @@ -404,10 +404,15 @@ Showing code examples single: sourcecode There are multiple ways to show syntax-highlighted literal code blocks in -Sphinx: using :ref:`reST doctest blocks <rst-doctest-blocks>`; using :ref:`reST -literal blocks <rst-literal-blocks>`, optionally in combination with the -:rst:dir:`highlight` directive; using the :rst:dir:`code-block` directive; and -using the :rst:dir:`literalinclude` directive. Doctest blocks can only be used +Sphinx: + +* using :ref:`reST doctest blocks <rst-doctest-blocks>`; +* using :ref:`reST literal blocks <rst-literal-blocks>`, optionally in + combination with the :rst:dir:`highlight` directive; +* using the :rst:dir:`code-block` directive; +* and using the :rst:dir:`literalinclude` directive. + +Doctest blocks can only be used to show interactive Python sessions, while the remaining three can be used for other languages. Of these three, literal blocks are useful when an entire document, or at least large sections of it, use code blocks with the same |