Collection of Directives Available in Sphinx#
A directive is a common block in markup languages.
toctree#
Abbreviation for Table of Contents
Strings that cannot be specified in toctree
genindex
modindex
search
Names that start with an underscore (_)
Directive:
.. toctree::
:maxdepth: 2
:numbered:
:caption: caption text
:name: name text
:titlesonly:
:glob:
:hidden:
:includehidden:
intro
All about strings <strings>
datatypes
intro*
recipe/*
code-block#
Example:
.. code-block:: python
:caption: サンプル
:linenos:
:emphasize-lines: 4
def factorial(x):
if x == 0:
return 1
# 強調
else:
return x * factorial(x - 1)
Output
1def factorial(x):
2 if x == 0:
3 return 1
4 # 強調
5 else:
6 return x * factorial(x - 1)
todo#
Directive:
.. todo:: ディレクティブ紹介例に掲載のTODO
After rendering:
Todo
The TODO featured in the directive introduction example
todolist#
Directive:
.. todolist::
After rendering:
Todo
The TODO featured in the directive introduction example
(The original entry is located in /opt/build/repo/docs/tools/sphinx/directives.rst, line 73.)
code#
Directive:
.. code-block:: shell
echo Hello world
After rendering:
echo Hello world
image#
Directive:
.. image:: https://unsplash.it/336/280/?random
After rendering:
figure#
Directive:
.. figure:: /_static/logo.png
After rendering:
link#
Directive:
`Title <http://link>`_
After rendering:
admonition#
Directive:
.. admonition:: lorem30
Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae placeat quia, magnam iusto cum beatae adipisci. Omnis nisi alias dolor. Quidem et fugiat minima saepe atque sed totam quibusdam perspiciatis!
After rendering:
lorem30
Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae placeat quia, magnam iusto cum beatae adipisci. Omnis nisi alias dolor. Quidem et fugiat minima saepe atque sed totam quibusdam perspiciatis!
attention#
Directive:
.. attention:: attention
After rendering:
Attention
attention
note#
Directive:
.. note:: note
After rendering:
Note
note
warning#
Directive:
.. warning:: warning
After rendering:
Warning
warning
error#
Directive:
.. error:: error
After rendering:
Error
error
hint#
Directive:
.. hint:: hint
After rendering:
Hint
hint
important#
Directive:
.. important:: important
After rendering:
Important
important
caution#
Directive:
.. caution:: caution
After rendering:
Caution
caution
danger#
Directive:
.. danger:: danger
After rendering:
Danger
danger
tip#
Directive:
.. tip:: tip
After rendering:
Tip
tip
rubric#
Directive:
.. rubric:: rubric
After rendering:
rubric
math#
Directive:
:math:`\sqrt{16}`
After rendering:
\(\sqrt{16}\)
command#
Directive:
:command:`Title`
After rendering:
Title
file#
Directive:
:file:`path`
After rendering:
path
guilabel#
Directive:
:guilabel:`Title`
After rendering:
Title
key#
Directive:
:kbd:`shortcut`
After rendering:
shortcut