summaryrefslogtreecommitdiffstats
path: root/doc/usage
diff options
context:
space:
mode:
Diffstat (limited to 'doc/usage')
-rw-r--r--doc/usage/advanced/intl.rst127
-rw-r--r--doc/usage/advanced/websupport/quickstart.rst6
-rw-r--r--doc/usage/advanced/websupport/searchadapters.rst2
-rw-r--r--doc/usage/advanced/websupport/storagebackends.rst2
-rw-r--r--doc/usage/builders/index.rst95
-rw-r--r--doc/usage/configuration.rst4475
-rw-r--r--doc/usage/domains/c.rst367
-rw-r--r--doc/usage/domains/cpp.rst760
-rw-r--r--doc/usage/domains/index.rst210
-rw-r--r--doc/usage/domains/javascript.rst132
-rw-r--r--doc/usage/domains/mathematics.rst22
-rw-r--r--doc/usage/domains/python.rst744
-rw-r--r--doc/usage/domains/restructuredtext.rst100
-rw-r--r--doc/usage/domains/standard.rst133
-rw-r--r--doc/usage/extensions/autodoc.rst83
-rw-r--r--doc/usage/extensions/autosectionlabel.rst4
-rw-r--r--doc/usage/extensions/autosummary.rst2
-rw-r--r--doc/usage/extensions/coverage.rst65
-rw-r--r--doc/usage/extensions/doctest.rst18
-rw-r--r--doc/usage/extensions/example_google.py1
-rw-r--r--doc/usage/extensions/example_numpy.py6
-rw-r--r--doc/usage/extensions/graphviz.rst6
-rw-r--r--doc/usage/extensions/ifconfig.rst2
-rw-r--r--doc/usage/extensions/inheritance.rst2
-rw-r--r--doc/usage/extensions/intersphinx.rst5
-rw-r--r--doc/usage/extensions/math.rst6
-rw-r--r--doc/usage/extensions/napoleon.rst8
-rw-r--r--doc/usage/index.rst2
-rw-r--r--doc/usage/installation.rst220
-rw-r--r--doc/usage/quickstart.rst88
-rw-r--r--doc/usage/referencing.rst269
-rw-r--r--doc/usage/restructuredtext/basics.rst74
-rw-r--r--doc/usage/restructuredtext/directives.rst403
-rw-r--r--doc/usage/restructuredtext/domains.rst2563
-rw-r--r--doc/usage/restructuredtext/field-lists.rst8
-rw-r--r--doc/usage/restructuredtext/index.rst9
-rw-r--r--doc/usage/restructuredtext/roles.rst284
-rw-r--r--doc/usage/theming.rst10
38 files changed, 6629 insertions, 4684 deletions
diff --git a/doc/usage/advanced/intl.rst b/doc/usage/advanced/intl.rst
index ae6e7dc..8f16259 100644
--- a/doc/usage/advanced/intl.rst
+++ b/doc/usage/advanced/intl.rst
@@ -27,7 +27,7 @@ Sphinx uses these facilities to translate whole documents.
Initially project maintainers have to collect all translatable strings (also
referred to as *messages*) to make them known to translators. Sphinx extracts
-these through invocation of ``sphinx-build -b gettext``.
+these through invocation of :command:`sphinx-build -M gettext`.
Every single element in the doctree will end up in a single message which
results in lists being equally split into different chunks while large
@@ -51,13 +51,13 @@ through :program:`msgfmt` for efficiency reasons. If you make these files
discoverable with :confval:`locale_dirs` for your :confval:`language`, Sphinx
will pick them up automatically.
-An example: you have a document ``usage.rst`` in your Sphinx project. The
-*gettext* builder will put its messages into ``usage.pot``. Imagine you have
-Spanish translations [2]_ stored in ``usage.po`` --- for your builds to
+An example: you have a document :file:`usage.rst` in your Sphinx project. The
+*gettext* builder will put its messages into :file:`usage.pot`. Imagine you have
+Spanish translations [2]_ stored in :file:`usage.po` --- for your builds to
be translated you need to follow these instructions:
* Compile your message catalog to a locale directory, say ``locale``, so it
- ends up in ``./locale/es/LC_MESSAGES/usage.mo`` in your source directory
+ ends up in :file:`./locale/es/LC_MESSAGES/usage.mo` in your source directory
(where ``es`` is the language code for Spanish.) ::
msgfmt "usage.po" -o "locale/es/LC_MESSAGES/usage.mo"
@@ -101,7 +101,7 @@ section describe an easy way to translate with *sphinx-intl*.
$ pip install sphinx-intl
-#. Add configurations to ``conf.py``.
+#. Add configurations to :file:`conf.py`.
::
@@ -137,7 +137,7 @@ section describe an easy way to translate with *sphinx-intl*.
#. Translate po files.
As noted above, these are located in the ``./locale/<lang>/LC_MESSAGES``
- directory. An example of one such file, from Sphinx, ``builders.po``, is
+ directory. An example of one such file, from Sphinx, :file:`builders.po`, is
given below.
.. code-block:: po
@@ -160,12 +160,12 @@ section describe an easy way to translate with *sphinx-intl*.
"FILL HERE BY TARGET LANGUAGE FILL HERE BY TARGET LANGUAGE FILL HERE "
"BY TARGET LANGUAGE :ref:`EXTENSIONS <extensions>` FILL HERE."
- Please be careful not to break reST notation. Most po-editors will help you
- with that.
+ Please be careful not to break reStructuredText notation.
+ Most po-editors will help you with that.
#. Build translated document.
- You need a :confval:`language` parameter in ``conf.py`` or you may also
+ You need a :confval:`language` parameter in :file:`conf.py` or you may also
specify the parameter on the command line.
For BSD/GNU make, run:
@@ -218,23 +218,27 @@ Using Transifex service for team translation
--------------------------------------------
Transifex_ is one of several services that allow collaborative translation via a
-web interface. It has a nifty Python-based command line client that makes it
+web interface. It has a nifty Go-based command line client that makes it
easy to fetch and push translations.
.. TODO: why use transifex?
-#. Install `transifex-client`_.
+#. Install the `Transifex CLI tool`_.
- You need :command:`tx` command to upload resources (pot files).
+ You need the :command:`tx` command line tool for uploading resources (pot files).
+ The official installation process place the :file:`tx` binary file in
+ the current directory along with a README and a LICENSE file, and adds
+ the current directory to ``$PATH``.
.. code-block:: console
- $ pip install transifex-client
+ $ curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
.. seealso:: `Transifex Client documentation`_
-#. Create your Transifex_ account and create new project for your document.
+#. Create your Transifex_ account and create a new project and an organization
+ for your document.
Currently, Transifex does not allow for a translation project to have more
than one version of the document, so you'd better include a version number in
@@ -242,45 +246,75 @@ easy to fetch and push translations.
For example:
+ :Organization ID: ``sphinx-document``
:Project ID: ``sphinx-document-test_1_0``
:Project URL: ``https://www.transifex.com/projects/p/sphinx-document-test_1_0/``
-#. Create config files for :command:`tx` command.
+#. Create an API token to be used in the command-line.
- This process will create ``.tx/config`` in the current directory, as well as
- a ``~/.transifexrc`` file that includes auth information.
+ Go to your `Transifex API token`_ page and generate a token.
+ Copy the generated token now, as you will not be able to see it again later.
+
+#. Set your Transifex API token in the user configuration file
+ :file:`$HOME/.transifexrc`.
+
+ .. code-block:: ini
+
+ [https://app.transifex.com]
+ rest_hostname = https://rest.api.transifex.com
+ token = paste_your_api_token_here
+
+#. Alternatively, you can store your Transifex API token as the environment variable
+ ``TX_TOKEN``, which is recognized and used by :command:`tx`.
+
+ .. code-block:: console
+
+ $ export TX_TOKEN=paste_your_api_token_here
+
+#. Create the project's config file for :command:`tx` command.
+
+ This process will create ``.tx/config`` in the current directory.
.. code-block:: console
+ $ cd /your/document/root
$ tx init
- Creating .tx folder...
- Transifex instance [https://www.transifex.com]:
- ...
- Please enter your transifex username: <transifex-username>
- Password: <transifex-password>
- ...
- Done.
+
+ Successful creation of '.tx/config' file
#. Upload pot files to Transifex service.
- Register pot files to ``.tx/config`` file:
+ Register pot files to ``.tx/config`` file using
+ :command:`sphinx-intl update-txconfig-resources`, adjusting
+ ``--pot-dir`` value to your project's pot files' directory:
.. code-block:: console
$ cd /your/document/root
$ sphinx-intl update-txconfig-resources --pot-dir _build/locale \
- --transifex-project-name sphinx-document-test_1_0
+ --transifex-organization-name=sphinx-document \
+ --transifex-project-name=sphinx-document-test_1_0
+
+ You can use the ``SPHINXINTL_TRANSIFEX_ORGANIZATION_NAME`` and
+ ``SPHINXINTL_TRANSIFEX_PROJECT_NAME`` environment variables
+ instead of the respective command line arguments.
+
+ .. seealso:: `sphinx-intl update-txconfig-resources documentation`_
and upload pot files:
.. code-block:: console
$ tx push -s
- Pushing translations for resource sphinx-document-test_1_0.builders:
- Pushing source file (locale/pot/builders.pot)
- Resource does not exist. Creating...
- ...
- Done.
+ # Getting info about resources
+
+ sphinx-document-test_1_0.builders - Getting info
+ sphinx-document-test_1_0.builders - Done
+
+ # Pushing source files
+
+ sphinx-document-test_1_0.builders - Uploading file
+ sphinx-document-test_1_0.builders - Done
#. Forward the translation on Transifex.
@@ -295,12 +329,18 @@ easy to fetch and push translations.
$ cd /your/document/root
$ tx pull -l de
- Pulling translations for resource sphinx-document-test_1_0.builders (...)
- -> de: locale/de/LC_MESSAGES/builders.po
- ...
- Done.
+ # Getting info about resources
+
+ sphinx-document-test_1_0.builders - Getting info
+ sphinx-document-test_1_0.builders - Done
+
+ # Pulling files
+
+ sphinx-document-test_1_0.builders [de] - Pulling file
+ sphinx-document-test_1_0.builders [de] - Creating download job
+ sphinx-document-test_1_0.builders [de] - Done
- Invoke :command:`make html` (for BSD/GNU make):
+ Invoke :command:`make html` (for BSD/GNU make) passing the language code:
.. code-block:: console
@@ -338,7 +378,8 @@ There is a `sphinx translation page`_ for Sphinx (master) documentation.
4. Wait acceptance by Transifex sphinx translation maintainers.
5. (After acceptance) Translate on Transifex.
-Detail is here: https://docs.transifex.com/getting-started-1/translators
+Detail is here:
+https://help.transifex.com/en/articles/6248698-getting-started-as-a-translator
Translation progress and statistics
@@ -364,9 +405,11 @@ percentage of nodes that have been translated on a per-document basis.
for details on that software suite.
.. [2] Because nobody expects the Spanish Inquisition!
-.. _`transifex-client`: https://pypi.org/project/transifex-client/
+.. _`Transifex CLI tool`: https://github.com/transifex/cli/
.. _`sphinx-intl`: https://pypi.org/project/sphinx-intl/
-.. _Transifex: https://www.transifex.com/
+.. _Transifex: https://app.transifex.com/
.. _Weblate's documentation: https://docs.weblate.org/en/latest/devel/sphinx.html
-.. _`sphinx translation page`: https://www.transifex.com/sphinx-doc/sphinx-doc/
-.. _`Transifex Client documentation`: https://docs.transifex.com/client/introduction/
+.. _`sphinx translation page`: https://app.transifex.com/sphinx-doc/sphinx-doc/
+.. _`Transifex Client documentation`: https://developers.transifex.com/docs/using-the-client
+.. _`Transifex API token`: https://app.transifex.com/user/settings/api/
+.. _`sphinx-intl update-txconfig-resources documentation`: https://sphinx-intl.readthedocs.io/en/master/refs.html#sphinx-intl-update-txconfig-resources
diff --git a/doc/usage/advanced/websupport/quickstart.rst b/doc/usage/advanced/websupport/quickstart.rst
index 1cdd23f..b75c617 100644
--- a/doc/usage/advanced/websupport/quickstart.rst
+++ b/doc/usage/advanced/websupport/quickstart.rst
@@ -21,7 +21,7 @@ things are in a document. To do this you will need to create an instance of the
support.build()
This will read reStructuredText sources from ``srcdir`` and place the necessary
-data in ``builddir``. The ``builddir`` will contain two sub-directories: one
+data in ``builddir``. The ``builddir`` will contain two subdirectories: one
named "data" that contains all the data needed to display documents, search
through documents, and add comments to documents. The other directory will be
called "static" and contains static files that should be served from "/static".
@@ -137,7 +137,7 @@ add this data to the ``COMMENT_OPTIONS`` that are used in the template.
This only works if your documentation is served from your
document root. If it is served from another directory, you will
- need to prefix the url route with that directory, and give the `docroot`
+ need to prefix the url route with that directory, and give the *docroot*
keyword argument when creating the web support object::
support = WebSupport(..., docroot='docs')
@@ -150,7 +150,7 @@ Performing Searches
To use the search form built-in to the Sphinx sidebar, create a function to
handle requests to the URL 'search' relative to the documentation root. The
-user's search query will be in the GET parameters, with the key `q`. Then use
+user's search query will be in the GET parameters, with the key ``q``. Then use
the :meth:`~sphinxcontrib.websupport.WebSupport.get_search_results` method to
retrieve search results. In `Flask <https://flask.palletsprojects.com/>`_ that
would be like this::
diff --git a/doc/usage/advanced/websupport/searchadapters.rst b/doc/usage/advanced/websupport/searchadapters.rst
index 262d666..ad7a11c 100644
--- a/doc/usage/advanced/websupport/searchadapters.rst
+++ b/doc/usage/advanced/websupport/searchadapters.rst
@@ -7,7 +7,7 @@ Search Adapters
To create a custom search adapter you will need to subclass the
:class:`BaseSearch` class. Then create an instance of the new class and pass
-that as the `search` keyword argument when you create the :class:`~.WebSupport`
+that as the *search* keyword argument when you create the :class:`~.WebSupport`
object::
support = WebSupport(srcdir=srcdir,
diff --git a/doc/usage/advanced/websupport/storagebackends.rst b/doc/usage/advanced/websupport/storagebackends.rst
index ccb00b6..c50edf8 100644
--- a/doc/usage/advanced/websupport/storagebackends.rst
+++ b/doc/usage/advanced/websupport/storagebackends.rst
@@ -7,7 +7,7 @@ Storage Backends
To create a custom storage backend you will need to subclass the
:class:`StorageBackend` class. Then create an instance of the new class and
-pass that as the `storage` keyword argument when you create the
+pass that as the *storage* keyword argument when you create the
:class:`~.WebSupport` object::
support = WebSupport(srcdir=srcdir,
diff --git a/doc/usage/builders/index.rst b/doc/usage/builders/index.rst
index ce2c5dc..e293399 100644
--- a/doc/usage/builders/index.rst
+++ b/doc/usage/builders/index.rst
@@ -10,17 +10,70 @@ Builders
These are the built-in Sphinx builders. More builders can be added by
:doc:`extensions </usage/extensions/index>`.
-The builder's "name" must be given to the **-b** command-line option of
+The builder's "name" must be given to the **-M** or **-b** command-line options of
:program:`sphinx-build` to select a builder.
+The most common builders are:
+
+**html**
+ Build HTML pages. This is the default builder.
+
+**dirhtml**
+ Build HTML pages, but with a single directory per document. Makes for
+ prettier URLs (no ``.html``) if served from a webserver.
+
+**singlehtml**
+ Build a single HTML with the whole content.
+
+**htmlhelp**, **qthelp**, **devhelp**, **epub**
+ Build HTML files with additional information for building a documentation
+ collection in one of these formats.
+
+**applehelp**
+ Build an Apple Help Book. Requires :program:`hiutil` and
+ :program:`codesign`, which are not Open Source and presently only
+ available on Mac OS X 10.6 and higher.
+
+**latex**
+ Build LaTeX sources that can be compiled to a PDF document using
+ :program:`pdflatex`.
+
+**man**
+ Build manual pages in groff format for UNIX systems.
+
+**texinfo**
+ Build Texinfo files that can be processed into Info files using
+ :program:`makeinfo`.
+
+**text**
+ Build plain text files.
+
+**gettext**
+ Build gettext-style message catalogs (``.pot`` files).
+
+**doctest**
+ Run all doctests in the documentation, if the :mod:`~sphinx.ext.doctest`
+ extension is enabled.
+
+**linkcheck**
+ Check the integrity of all external links.
+
+**xml**
+ Build Docutils-native XML files.
+
+**pseudoxml**
+ Build compact pretty-printed "pseudo-XML" files displaying the
+ internal structure of the intermediate document trees.
+
+--------------
.. module:: sphinx.builders.html
.. class:: StandaloneHTMLBuilder
This is the standard HTML builder. Its output is a directory with HTML
- files, complete with style sheets and optionally the reST sources. There are
- quite a few configuration values that customize the output of this builder,
- see the chapter :ref:`html-options` for details.
+ files, complete with style sheets and optionally the reStructuredText sources.
+ There are quite a few configuration values that customize
+ the output of this builder, see the chapter :ref:`html-options` for details.
.. autoattribute:: name
@@ -146,7 +199,7 @@ The builder's "name" must be given to the **-b** command-line option of
This builder produces the same output as the standalone HTML builder, but
also generates an *epub* file for ebook readers. See :ref:`epub-faq` for
details about it. For definition of the epub format, have a look at
- `<http://idpf.org/epub>`_ or `<https://en.wikipedia.org/wiki/EPUB>`_.
+ `<https://idpf.org/epub>`_ or `<https://en.wikipedia.org/wiki/EPUB>`_.
The builder creates *EPUB 3* files.
.. autoattribute:: name
@@ -184,6 +237,8 @@ The builder's "name" must be given to the **-b** command-line option of
* ``texlive-latex-recommended``
* ``texlive-fonts-recommended``
+ * ``texlive-fonts-extra`` (needed for ``fontawesome5``, see the 7.4.0
+ change notice below)
* ``tex-gyre`` (if :confval:`latex_engine` left to default)
* ``texlive-latex-extra``
* ``latexmk``
@@ -191,6 +246,12 @@ The builder's "name" must be given to the **-b** command-line option of
.. versionchanged:: 4.0.0
TeX Gyre fonts now required for ``'pdflatex'`` engine (default).
+ .. versionchanged:: 7.4.0
+ LaTeX package ``xcolor`` is now required (it is part of Ubuntu
+ ``texlive-latex-recommended`` anyhow). The LaTeX package
+ ``fontawesome5`` is recommended. See the :ref:`'sphinxsetup'
+ <latexsphinxsetup>` ``iconpackage`` key for more.
+
Additional packages are needed in some circumstances:
* ``texlive-lang-cyrillic`` for Cyrillic (and also then
@@ -245,9 +306,9 @@ name is ``rinoh``. Refer to the `rinohtype manual`_ for details.
.. module:: sphinx.builders.text
.. class:: TextBuilder
- This builder produces a text file for each reST file -- this is almost the
- same as the reST source, but with much of the markup stripped for better
- readability.
+ This builder produces a text file for each reStructuredText file.
+ This is almost the same as the reStructuredText source,
+ but with much of the markup stripped for better readability.
.. autoattribute:: name
@@ -300,8 +361,8 @@ name is ``rinoh``. Refer to the `rinohtype manual`_ for details.
.. class:: SerializingHTMLBuilder
This builder uses a module that implements the Python serialization API
- (`pickle`, `simplejson`, `phpserialize`, and others) to dump the generated
- HTML documentation. The pickle builder is a subclass of it.
+ (``pickle``, ``simplejson``, ``phpserialize``, and others) to dump the
+ generated HTML documentation. The pickle builder is a subclass of it.
A concrete subclass of this builder serializing to the `PHP serialization`_
format could look like this::
@@ -319,10 +380,10 @@ name is ``rinoh``. Refer to the `rinohtype manual`_ for details.
.. attribute:: implementation
- A module that implements `dump()`, `load()`, `dumps()` and `loads()`
+ A module that implements ``dump()``, ``load()``, ``dumps()`` and ``loads()``
functions that conform to the functions with the same names from the
pickle module. Known modules implementing this interface are
- `simplejson`, `phpserialize`, `plistlib`, and others.
+ ``simplejson``, ``phpserialize``, ``plistlib``, and others.
.. attribute:: out_suffix
@@ -400,9 +461,9 @@ name is ``rinoh``. Refer to the `rinohtype manual`_ for details.
.. class:: ChangesBuilder
This builder produces an HTML overview of all :rst:dir:`versionadded`,
- :rst:dir:`versionchanged` and :rst:dir:`deprecated` directives for the
- current :confval:`version`. This is useful to generate a ChangeLog file, for
- example.
+ :rst:dir:`versionchanged`, :rst:dir:`deprecated` and :rst:dir:`versionremoved`
+ directives for the current :confval:`version`. This is useful to generate a
+ changelog file, for example.
.. autoattribute:: name
@@ -487,8 +548,8 @@ Serialization builder details
-----------------------------
All serialization builders outputs one file per source file and a few special
-files. They also copy the reST source files in the directory ``_sources``
-under the output directory.
+files. They also copy the reStructuredText source files
+to the ``_sources`` directory under the output directory.
The :class:`.PickleHTMLBuilder` is a builtin subclass that implements the pickle
serialization interface.
diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst
index d440132..cd56674 100644
--- a/doc/usage/configuration.rst
+++ b/doc/usage/configuration.rst
@@ -1,5 +1,3 @@
-.. highlight:: python
-
.. _build-config:
=============
@@ -9,10 +7,23 @@ Configuration
.. module:: conf
:synopsis: Build configuration file.
+.. role:: code-c(code)
+ :language: C
+.. role:: code-cpp(code)
+ :language: C++
+.. role:: code-js(code)
+ :language: JavaScript
+.. role:: code-py(code)
+ :language: Python
+.. role:: code-rst(code)
+ :language: reStructuredText
+.. role:: code-tex(code)
+ :language: LaTeX
+
The :term:`configuration directory` must contain a file named :file:`conf.py`.
This file (containing Python code) is called the "build configuration file"
-and contains (almost) all configuration needed to customize Sphinx input
-and output behavior.
+and contains (almost) all configuration needed to customise Sphinx input
+and output behaviour.
An optional file `docutils.conf`_ can be added to the configuration
directory to adjust `Docutils`_ configuration if not otherwise overridden or
@@ -21,1030 +32,1399 @@ set by Sphinx.
.. _`docutils`: https://docutils.sourceforge.io/
.. _`docutils.conf`: https://docutils.sourceforge.io/docs/user/config.html
-The configuration file is executed as Python code at build time (using
-:func:`importlib.import_module`, and with the current directory set to its
-containing directory), and therefore can execute arbitrarily complex code.
-Sphinx then reads simple names from the file's namespace as its configuration.
-
Important points to note:
-* If not otherwise documented, values must be strings, and their default is the
- empty string.
+* If not otherwise documented, values must be strings,
+ and their default is the empty string.
+
+* The term "fully-qualified name" (FQN) refers to a string that names an importable
+ Python object inside a module; for example, the fully-qualified name
+ :code-py:`"sphinx.builders.Builder"` means the :code-py:`Builder` class in the
+ :code-py:`sphinx.builders` module.
+
+* Document names use ``/`` as the path separator
+ and do not contain the file name extension.
+
+.. _glob-style patterns:
+
+* Where glob-style patterns are permitted,
+ you can use the standard shell constructs
+ (``*``, ``?``, ``[...]``, and ``[!...]``)
+ with the feature that none of these will match slashes (``/``).
+ A double star ``**`` can be used to match any sequence of characters
+ *including* slashes.
+
+.. tip::
+
+ The configuration file is executed as Python code at build time
+ (using :func:`importlib.import_module`, with the current directory set
+ to the :term:`configuration directory`),
+ and therefore can execute arbitrarily complex code.
-* The term "fully-qualified name" refers to a string that names an importable
- Python object inside a module; for example, the FQN
- ``"sphinx.builders.Builder"`` means the ``Builder`` class in the
- ``sphinx.builders`` module.
+ Sphinx then reads simple names from the file's namespace as its configuration.
+ In general, configuration values should be simple strings, numbers, or
+ lists or dictionaries of simple values.
-* Remember that document names use ``/`` as the path separator and don't
- contain the file name extension.
+ The contents of the config namespace are pickled (so that Sphinx can find out
+ when configuration changes), so it may not contain unpickleable values --
+ delete them from the namespace with ``del`` if appropriate.
+ Modules are removed automatically, so deleting imported modules is not needed.
-* Since :file:`conf.py` is read as a Python file, the usual rules apply for
- encodings and Unicode support.
-* The contents of the config namespace are pickled (so that Sphinx can find out
- when configuration changes), so it may not contain unpickleable values --
- delete them from the namespace with ``del`` if appropriate. Modules are
- removed automatically, so you don't need to ``del`` your imports after use.
+.. _conf-tags:
- .. _conf-tags:
+Project tags
+============
-* There is a special object named ``tags`` available in the config file.
- It can be used to query and change the tags (see :ref:`tags`). Use
- ``tags.has('tag')`` to query, ``tags.add('tag')`` and ``tags.remove('tag')``
- to change. Only tags set via the ``-t`` command-line option or via
- ``tags.add('tag')`` can be queried using ``tags.has('tag')``.
- Note that the current builder tag is not available in ``conf.py``, as it is
- created *after* the builder is initialized.
+There is a special object named ``tags`` available in the config file,
+which exposes the :ref:`project tags <tags>`.
+Tags are defined either via the
+:option:`--tag <sphinx-build --tag>` command-line option
+or :code-py:`tags.add('tag')`.
+Note that the builder's name and format tags are not available in :file:`conf.py`.
+It can be used to query and change the defined tags as follows:
+
+* To query whether a tag is set, use :code-py:`'tag' in tags`.
+* To add a tag, use :code-py:`tags.add('tag')`.
+* To remove a tag, use :code-py:`tags.remove('tag')`.
Project information
--------------------
+===================
.. confval:: project
+ :type: :code-py:`str`
+ :default: :code-py:`'Project name not set'`
The documented project's name.
+ Example:
+
+ .. code-block:: python
+
+ project = 'Thermidor'
.. confval:: author
+ :type: :code-py:`str`
+ :default: :code-py:`'Author name not set'`
+
+ The project's author(s).
+ Example:
+
+ .. code-block:: python
- The author name(s) of the document. The default value is ``'unknown'``.
+ author = 'Joe Bloggs'
.. confval:: copyright
+ project_copyright
+ :type: :code-py:`str | Sequence[str]`
+ :default: :code-py:`''`
- A copyright statement in the style ``'2008, Author Name'``.
+ A copyright statement.
+ Permitted styles are as follows, where 'YYYY' represents a four-digit year.
+
+ * :code-py:`copyright = 'YYYY'`
+ * :code-py:`copyright = 'YYYY, Author Name'`
+ * :code-py:`copyright = 'YYYY Author Name'`
+ * :code-py:`copyright = 'YYYY-YYYY, Author Name'`
+ * :code-py:`copyright = 'YYYY-YYYY Author Name'`
+
+ .. versionadded:: 3.5
+ The :code-py:`project_copyright` alias.
.. versionchanged:: 7.1
The value may now be a sequence of copyright statements in the above form,
which will be displayed each to their own line.
-.. confval:: project_copyright
+.. confval:: version
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- An alias of :confval:`copyright`.
+ The major project version, used as the replacement for the :code-rst:`|version|`
+ :ref:`default substitution <default-substitutions>`.
- .. versionadded:: 3.5
+ This may be something like :code-py:`version = '4.2'`.
+ The full project version is defined in :confval:`release`.
-.. confval:: version
-
- The major project version, used as the replacement for ``|version|``. For
- example, for the Python documentation, this may be something like ``2.6``.
+ If your project does not draw a meaningful distinction between
+ between a 'full' and 'major' version,
+ set both :code-py:`version` and :code-py:`release` to the same value.
.. confval:: release
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- The full project version, used as the replacement for ``|release|`` and
- e.g. in the HTML templates. For example, for the Python documentation, this
- may be something like ``2.6.0rc1``.
+ The full project version, used as the replacement for the :code-rst:`|release|`
+ :ref:`default substitution <default-substitutions>`, and
+ e.g. in the HTML templates.
- If you don't need the separation provided between :confval:`version` and
- :confval:`release`, just set them both to the same value.
+ This may be something like :code-py:`release = '4.2.1b0'`.
+ The major (short) project version is defined in :confval:`version`.
+
+ If your project does not draw a meaningful distinction between
+ between a 'full' and 'major' version,
+ set both :code-py:`version` and :code-py:`release` to the same value.
General configuration
----------------------
+=====================
+
+.. confval:: needs_sphinx
+ :type: :code-py:`str`
+ :default: :code-py:`''`
+
+ Set a minimum supported version of Sphinx required to build the project.
+ The format should be a ``'major.minor'`` version string like ``'1.1'``
+ Sphinx will compare it with its version and refuse to build the project
+ if the running version of Sphinx is too old.
+ By default, there is no minimum version.
+
+ .. versionadded:: 1.0
+
+ .. versionchanged:: 1.4
+ Allow a ``'major.minor.micro'`` version string.
.. confval:: extensions
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
- A list of strings that are module names of :doc:`extensions
- <extensions/index>`. These can be extensions coming with Sphinx (named
- ``sphinx.ext.*``) or custom ones.
+ A list of strings that are module names of
+ :doc:`Sphinx extensions <extensions/index>`.
+ These can be extensions bundled with Sphinx (named ``sphinx.ext.*``)
+ or custom first-party or third-party extensions.
- Note that you can extend :data:`sys.path` within the conf file if your
- extensions live in another directory -- but make sure you use absolute paths.
- If your extension path is relative to the :term:`configuration directory`,
- use :func:`os.path.abspath` like so::
+ To use a third-party extension, you must ensure that it is installed
+ and include it in the :code-py:`extensions` list, like so:
- import sys, os
+ .. code-block:: python
- sys.path.append(os.path.abspath('sphinxext'))
+ extensions = [
+ ...
+ 'numpydoc',
+ ]
- extensions = ['extname']
+ There are two options for first-party extensions.
+ The configuration file itself can be an extension;
+ for that, you only need to provide a :func:`setup` function in it.
+ Otherwise, you must ensure that your custom extension is importable,
+ and located in a directory that is in the Python path.
- That way, you can load an extension called ``extname`` from the subdirectory
- ``sphinxext``.
+ Ensure that absolute paths are used when modifying :data:`sys.path`.
+ If your custom extensions live in a directory that is relative to the
+ :term:`configuration directory`, use :func:`os.path.abspath` like so:
- The configuration file itself can be an extension; for that, you only need
- to provide a :func:`setup` function in it.
+ .. code-block:: python
-.. confval:: source_suffix
+ import os, sys; sys.path.append(os.path.abspath('sphinxext'))
- The file extensions of source files. Sphinx considers the files with this
- suffix as sources. The value can be a dictionary mapping file extensions
- to file types. For example::
+ extensions = [
+ ...
+ 'extname',
+ ]
- source_suffix = {
- '.rst': 'restructuredtext',
- '.txt': 'restructuredtext',
- '.md': 'markdown',
+ The directory structure illustrated above would look like this:
+
+ .. code-block:: none
+
+ <project directory>/
+ ├── conf.py
+ └── sphinxext/
+    └── extname.py
+
+
+.. confval:: needs_extensions
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
+
+ If set, this value must be a dictionary specifying version requirements
+ for extensions in :confval:`extensions`.
+ The version strings should be in the ``'major.minor'`` form.
+ Requirements do not have to be specified for all extensions,
+ only for those you want to check.
+ Example:
+
+ .. code-block:: python
+
+ needs_extensions = {
+ 'sphinxcontrib.something': '1.5',
}
- By default, Sphinx only supports ``'restructuredtext'`` file type. You can
- add a new file type using source parser extensions. Please read a document
- of the extension to know which file type the extension supports.
+ This requires that the extension declares its version
+ in the :code-py:`setup()` function. See :ref:`dev-extensions` for further details.
- The value may also be a list of file extensions: then Sphinx will consider
- that they all map to the ``'restructuredtext'`` file type.
+ .. versionadded:: 1.3
- Default is ``{'.rst': 'restructuredtext'}``.
+.. confval:: manpages_url
+ :type: :code-py:`str`
+ :default: :code-py:`''`
+
+ A URL to cross-reference :rst:role:`manpage` roles.
+ If this is defined to ``https://manpages.debian.org/{path}``,
+ the :literal:`:manpage:`man(1)`` role will link to
+ <https://manpages.debian.org/man(1)>.
+ The patterns available are:
+
+ ``page``
+ The manual page (``man``)
+ ``section``
+ The manual section (``1``)
+ ``path``
+ The original manual page and section specified (``man(1)``)
- .. note:: file extensions have to start with a dot (e.g. ``.rst``).
+ This also supports manpages specified as ``man.1``.
- .. versionchanged:: 1.3
- Can now be a list of extensions.
+ .. code-block:: python
- .. versionchanged:: 1.8
- Support file type mapping
+ # To use manpages.debian.org:
+ manpages_url = 'https://manpages.debian.org/{path}'
+ # To use man7.org:
+ manpages_url = 'https://man7.org/linux/man-pages/man{section}/{page}.{section}.html'
+ # To use linux.die.net:
+ manpages_url = 'https://linux.die.net/man/{section}/{page}'
+ # To use helpmanual.io:
+ manpages_url = 'https://helpmanual.io/man{section}/{page}'
-.. confval:: source_encoding
+ .. versionadded:: 1.7
- The encoding of all reST source files. The recommended encoding, and the
- default value, is ``'utf-8-sig'``.
+.. confval:: today
+ today_fmt
- .. versionadded:: 0.5
- Previously, Sphinx accepted only UTF-8 encoded sources.
+ These values determine how to format the current date,
+ used as the replacement for the :code-rst:`|today|`
+ :ref:`default substitution <default-substitutions>`.
+
+ * If you set :confval:`today` to a non-empty value, it is used.
+ * Otherwise, the current time is formatted using :func:`time.strftime` and
+ the format given in :confval:`today_fmt`.
+
+ The default for :confval:`today` is :code-py:`''`,
+ and the default for :confval:`today_fmt` is :code-py:`'%b %d, %Y'`
+ (or, if translation is enabled with :confval:`language`,
+ an equivalent format for the selected locale).
-.. confval:: source_parsers
- If given, a dictionary of parser classes for different source suffices. The
- keys are the suffix, the values can be either a class or a string giving a
- fully-qualified name of a parser class. The parser class can be either
- ``docutils.parsers.Parser`` or :class:`sphinx.parsers.Parser`. Files with a
- suffix that is not in the dictionary will be parsed with the default
- reStructuredText parser.
+Options for figure numbering
+----------------------------
- For example::
+.. confval:: numfig
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
+ If :code-py:`True`, figures, tables and code-blocks are automatically numbered
+ if they have a caption.
+ The :rst:role:`numref` role is enabled.
+ Obeyed so far only by HTML and LaTeX builders.
.. note::
- Refer to :doc:`/usage/markdown` for more information on using Markdown
- with Sphinx.
+ The LaTeX builder always assigns numbers whether this option is enabled
+ or not.
.. versionadded:: 1.3
- .. deprecated:: 1.8
- Now Sphinx provides an API :meth:`.Sphinx.add_source_parser` to register
- a source parser. Please use it instead.
+.. confval:: numfig_format
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
-.. confval:: master_doc
+ A dictionary mapping :code-py:`'figure'`, :code-py:`'table'`,
+ :code-py:`'code-block'` and :code-py:`'section'` to strings
+ that are used for format of figure numbers.
+ The marker ``%s`` will be replaced with the figure number.
- Same as :confval:`root_doc`.
+ The defaults are:
- .. versionchanged:: 4.0
- Renamed ``master_doc`` to ``root_doc``.
+ .. code-block:: python
-.. confval:: root_doc
+ numfig_format = {
+ 'code-block': 'Listing %s',
+ 'figure': 'Fig. %s',
+ 'section': 'Section',
+ 'table': 'Table %s',
+ }
- The document name of the "root" document, that is, the document that
- contains the root :rst:dir:`toctree` directive. Default is ``'index'``.
+ .. versionadded:: 1.3
- .. versionchanged:: 2.0
- The default is changed to ``'index'`` from ``'contents'``.
- .. versionchanged:: 4.0
- Renamed ``root_doc`` from ``master_doc``.
+.. confval:: numfig_secnum_depth
+ :type: :code-py:`int`
+ :default: :code-py:`1`
+
+ * If set to :code-py:`0`, figures, tables, and code-blocks
+ are continuously numbered starting at ``1``.
+ * If :code-py:`1`, the numbering will be ``x.1``, ``x.2``, ...
+ with ``x`` representing the section number.
+ (If there is no top-level section, the prefix will not be added ).
+ This naturally applies only if section numbering has been activated via
+ the ``:numbered:`` option of the :rst:dir:`toctree` directive.
+ * If :code-py:`2`, the numbering will be ``x.y.1``, ``x.y.2``, ...
+ with ``x`` representing the section number and ``y`` the sub-section number.
+ If located directly under a section, there will be no ``y.`` prefix,
+ and if there is no top-level section, the prefix will not be added.
+ * Any other positive integer can be used, following the rules above.
-.. confval:: exclude_patterns
+ .. versionadded:: 1.3
- A list of glob-style patterns [1]_ that should be excluded when looking for
- source files. They are matched against the source file names relative
- to the source directory, using slashes as directory separators on all
- platforms.
+ .. versionchanged:: 1.7
+ The LaTeX builder obeys this setting
+ if :confval:`numfig` is set to :code-py:`True`.
- Example patterns:
- - ``'library/xml.rst'`` -- ignores the ``library/xml.rst`` file
- - ``'library/xml'`` -- ignores the ``library/xml`` directory
- - ``'library/xml*'`` -- ignores all files and directories starting with
- ``library/xml``
- - ``'**/.svn'`` -- ignores all ``.svn`` directories
+Options for highlighting
+------------------------
- :confval:`exclude_patterns` is also consulted when looking for static files
- in :confval:`html_static_path` and :confval:`html_extra_path`.
+.. confval:: highlight_language
+ :type: :code-py:`str`
+ :default: :code-py:`'default'`
- .. versionadded:: 1.0
+ The default language to highlight source code in.
+ The default is :code-py:`'default'`,
+ which suppresses warnings if highlighting as Python code fails.
-.. confval:: include_patterns
+ The value should be a valid Pygments lexer name, see
+ :ref:`code-examples` for more details.
- A list of glob-style patterns [1]_ that are used to find source files. They
- are matched against the source file names relative to the source directory,
- using slashes as directory separators on all platforms. The default is ``**``,
- meaning that all files are recursively included from the source directory.
+ .. versionadded:: 0.5
- Example patterns:
+ .. versionchanged:: 1.4
+ The default is now :code-py:`'default'`.
- - ``'**'`` -- all files in the source directory and subdirectories, recursively
- - ``'library/xml'`` -- just the ``library/xml`` directory
- - ``'library/xml*'`` -- all files and directories starting with ``library/xml``
- - ``'**/doc'`` -- all ``doc`` directories (this might be useful if
- documentation is co-located with source files)
+.. confval:: highlight_options
+ :type: :code-py:`dict[str, dict[str, Any]]`
+ :default: :code-py:`{}`
- .. versionadded:: 5.1
+ A dictionary that maps Pygments lexer names to their options.
+ These are lexer-specific; for the options understood by each,
+ see the `Pygments documentation <https://pygments.org/docs/lexers>`_.
-.. confval:: templates_path
+ Example:
- A list of paths that contain extra templates (or templates that overwrite
- builtin/theme-specific templates). Relative paths are taken as relative to
- the configuration directory.
+ .. code-block:: python
- .. versionchanged:: 1.3
- As these files are not meant to be built, they are automatically added to
- :confval:`exclude_patterns`.
+ highlight_options = {
+ 'default': {'stripall': True},
+ 'php': {'startinline': True},
+ }
-.. confval:: template_bridge
+ .. versionadded:: 1.3
+ .. versionchanged:: 3.5
- A string with the fully-qualified name of a callable (or simply a class)
- that returns an instance of :class:`~sphinx.application.TemplateBridge`.
- This instance is then used to render HTML documents, and possibly the output
- of other builders (currently the changes builder). (Note that the template
- bridge must be made theme-aware if HTML themes are to be used.)
+ Allow configuring highlight options for multiple lexers.
-.. confval:: rst_epilog
+.. confval:: pygments_style
+ :type: :code-py:`str`
+ :default: :code-py:`'sphinx'`
- .. index:: pair: global; substitutions
+ The style name to use for Pygments highlighting of source code.
+ If not set, either the theme's default style
+ or :code-py:`'sphinx'` is selected for HTML output.
- A string of reStructuredText that will be included at the end of every source
- file that is read. This is a possible place to add substitutions that should
- be available in every file (another being :confval:`rst_prolog`). An
- example::
+ .. versionchanged:: 0.3
+ If the value is a fully-qualified name of a custom Pygments style class,
+ this is then used as custom style.
- rst_epilog = """
- .. |psf| replace:: Python Software Foundation
- """
- .. versionadded:: 0.6
+Options for HTTP requests
+-------------------------
-.. confval:: rst_prolog
+.. confval:: tls_verify
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- .. index:: pair: global; substitutions
+ If True, Sphinx verifies server certificates.
- A string of reStructuredText that will be included at the beginning of every
- source file that is read. This is a possible place to add substitutions that
- should be available in every file (another being :confval:`rst_epilog`). An
- example::
+ .. versionadded:: 1.5
- rst_prolog = """
- .. |psf| replace:: Python Software Foundation
- """
+.. confval:: tls_cacerts
+ :type: :code-py:`str | dict[str, str]`
+ :default: :code-py:`''`
- .. versionadded:: 1.0
+ A path to a certification file of CA or
+ a path to directory which contains the certificates.
+ This also allows a dictionary mapping
+ hostnames to the certificate file path.
+ The certificates are used to verify server certifications.
-.. confval:: primary_domain
+ .. versionadded:: 1.5
- .. index:: default; domain
- primary; domain
+ .. tip::
- The name of the default :doc:`domain </usage/restructuredtext/domains>`.
- Can also be ``None`` to disable a default domain. The default is ``'py'``.
- Those objects in other domains (whether the domain name is given explicitly,
- or selected by a :rst:dir:`default-domain` directive) will have the domain
- name explicitly prepended when named (e.g., when the default domain is C,
- Python functions will be named "Python function", not just "function").
+ Sphinx uses requests_ as a HTTP library internally.
+ If :confval:`!tls_cacerts` is not set,
+ Sphinx falls back to requests' default behaviour.
+ See :ref:`requests:verification` for further details.
- .. versionadded:: 1.0
+ .. _requests: https://requests.readthedocs.io/
-.. confval:: default_role
+.. confval:: user_agent
+ :type: :code-py:`str`
+ :default: :code-py:`'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 \
+ Firefox/100.0 Sphinx/X.Y.Z'`
- .. index:: default; role
+ Set the User-Agent used by Sphinx for HTTP requests.
- The name of a reST role (builtin or Sphinx extension) to use as the default
- role, that is, for text marked up ```like this```. This can be set to
- ``'py:obj'`` to make ```filter``` a cross-reference to the Python function
- "filter". The default is ``None``, which doesn't reassign the default role.
+ .. versionadded:: 2.3
- The default role can always be set within individual documents using the
- standard reST :dudir:`default-role` directive.
- .. versionadded:: 0.4
+.. _intl-options:
-.. confval:: keep_warnings
+Options for internationalisation
+--------------------------------
- If true, keep warnings as "system message" paragraphs in the built
- documents. Regardless of this setting, warnings are always written to the
- standard error stream when ``sphinx-build`` is run.
+These options influence Sphinx's *Native Language Support*.
+See the documentation on :ref:`intl` for details.
- The default is ``False``, the pre-0.5 behavior was to always keep them.
+.. confval:: language
+ :type: :code-py:`str`
+ :default: :code-py:`'en'`
+
+ The code for the language the documents are written in.
+ Any text automatically generated by Sphinx will be in that language.
+ Also, Sphinx will try to substitute individual paragraphs
+ from your documents with the translation sets obtained
+ from :confval:`locale_dirs`.
+ Sphinx will search language-specific figures named by
+ :confval:`figure_language_filename`
+ (e.g. the German version of ``myfigure.png`` will be ``myfigure.de.png``
+ by default setting)
+ and substitute them for original figures.
+ In the LaTeX builder, a suitable language will be selected
+ as an option for the *Babel* package.
.. versionadded:: 0.5
-.. confval:: suppress_warnings
+ .. versionchanged:: 1.4
+ Support figure substitution
- A list of warning types to suppress arbitrary warning messages.
+ .. versionchanged:: 5.0
+ The default is now :code-py:`'en'` (previously :code-py:`None`).
- Sphinx supports following warning types:
+ Currently supported languages by Sphinx are:
- * ``app.add_node``
- * ``app.add_directive``
- * ``app.add_role``
- * ``app.add_generic_role``
- * ``app.add_source_parser``
- * ``autosectionlabel.*``
- * ``download.not_readable``
- * ``epub.unknown_project_files``
- * ``epub.duplicated_toc_entry``
- * ``i18n.inconsistent_references``
- * ``index``
- * ``image.not_readable``
- * ``ref.term``
- * ``ref.ref``
- * ``ref.numref``
- * ``ref.keyword``
- * ``ref.option``
- * ``ref.citation``
- * ``ref.footnote``
- * ``ref.doc``
- * ``ref.python``
- * ``misc.highlighting_failure``
- * ``toc.circular``
- * ``toc.excluded``
- * ``toc.not_readable``
- * ``toc.secnum``
+ * ``ar`` -- Arabic
+ * ``bg`` -- Bulgarian
+ * ``bn`` -- Bengali
+ * ``ca`` -- Catalan
+ * ``cak`` -- Kaqchikel
+ * ``cs`` -- Czech
+ * ``cy`` -- Welsh
+ * ``da`` -- Danish
+ * ``de`` -- German
+ * ``el`` -- Greek
+ * ``en`` -- English (default)
+ * ``eo`` -- Esperanto
+ * ``es`` -- Spanish
+ * ``et`` -- Estonian
+ * ``eu`` -- Basque
+ * ``fa`` -- Iranian
+ * ``fi`` -- Finnish
+ * ``fr`` -- French
+ * ``he`` -- Hebrew
+ * ``hi`` -- Hindi
+ * ``hi_IN`` -- Hindi (India)
+ * ``hr`` -- Croatian
+ * ``hu`` -- Hungarian
+ * ``id`` -- Indonesian
+ * ``it`` -- Italian
+ * ``ja`` -- Japanese
+ * ``ko`` -- Korean
+ * ``lt`` -- Lithuanian
+ * ``lv`` -- Latvian
+ * ``mk`` -- Macedonian
+ * ``nb_NO`` -- Norwegian Bokmal
+ * ``ne`` -- Nepali
+ * ``nl`` -- Dutch
+ * ``pl`` -- Polish
+ * ``pt`` -- Portuguese
+ * ``pt_BR`` -- Brazilian Portuguese
+ * ``pt_PT`` -- European Portuguese
+ * ``ro`` -- Romanian
+ * ``ru`` -- Russian
+ * ``si`` -- Sinhala
+ * ``sk`` -- Slovak
+ * ``sl`` -- Slovenian
+ * ``sq`` -- Albanian
+ * ``sr`` -- Serbian
+ * ``sr@latin`` -- Serbian (Latin)
+ * ``sr_RS`` -- Serbian (Cyrillic)
+ * ``sv`` -- Swedish
+ * ``ta`` -- Tamil
+ * ``te`` -- Telugu
+ * ``tr`` -- Turkish
+ * ``uk_UA`` -- Ukrainian
+ * ``ur`` -- Urdu
+ * ``vi`` -- Vietnamese
+ * ``zh_CN`` -- Simplified Chinese
+ * ``zh_TW`` -- Traditional Chinese
- You can choose from these types. You can also give only the first
- component to exclude all warnings attached to it.
+.. confval:: locale_dirs
+ :type: :code-py:`list[str]`
+ :default: :code-py:`['locale']`
- Now, this option should be considered *experimental*.
+ Directories in which to search for additional message catalogs
+ (see :confval:`language`), relative to the source directory.
+ The directories on this path are searched by the :mod:`gettext` module.
- .. versionadded:: 1.4
+ Internal messages are fetched from a text domain of ``sphinx``;
+ so if you add the directory :file:`./locale` to this setting,
+ the message catalogs
+ (compiled from ``.po`` format using :program:`msgfmt`)
+ must be in :file:`./locale/{language}/LC_MESSAGES/sphinx.mo`.
+ The text domain of individual documents
+ depends on :confval:`gettext_compact`.
+
+ .. note::
+ The :option:`-v option to sphinx-build <sphinx-build -v>`
+ is useful to check the :confval:`!locale_dirs` setting is working as expected.
+ If the message catalog directory not found, debug messages are emitted.
+
+ .. versionadded:: 0.5
.. versionchanged:: 1.5
+ Use ``locales`` directory as a default value
- Added ``misc.highlighting_failure``
+.. confval:: gettext_allow_fuzzy_translations
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. versionchanged:: 1.5.1
+ If True, "fuzzy" messages in the message catalogs are used for translation.
- Added ``epub.unknown_project_files``
+ .. versionadded:: 4.3
- .. versionchanged:: 1.6
+.. confval:: gettext_compact
+ :type: :code-py:`bool | str`
+ :default: :code-py:`True`
+
+ * If :code-py:`True`, a document's text domain is
+ its docname if it is a top-level project file
+ and its very base directory otherwise.
+ * If :code-py:`False`, a document's text domain is
+ the docname, in full.
+ * If set to a string, every document's text domain is
+ set to this string, making all documents use single text domain.
+
+ With :code-py:`gettext_compact = True`, the document
+ :file:`markup/code.rst` ends up in the ``markup`` text domain.
+ With this option set to :code-py:`False`, it is ``markup/code``.
+ With this option set to :code-py:`'sample'`, it is ``sample``.
- Added ``ref.footnote``
+ .. versionadded:: 1.1
- .. versionchanged:: 2.1
+ .. versionchanged:: 3.3
+ Allow string values.
- Added ``autosectionlabel.*``
+.. confval:: gettext_uuid
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. versionchanged:: 3.3.0
+ If :code-py:`True`, Sphinx generates UUID information
+ for version tracking in message catalogs.
+ It is used to:
- Added ``epub.duplicated_toc_entry``
+ * Add a UUID line for each *msgid* in ``.pot`` files.
+ * Calculate similarity between new msgids and previously saved old msgids.
+ (This calculation can take a long time.)
- .. versionchanged:: 4.3
+ .. tip::
+ If you want to accelerate the calculation,
+ you can use a third-party package (Levenshtein_) by running
+ :command:`pip install levenshtein`.
- Added ``toc.excluded`` and ``toc.not_readable``
+ .. _Levenshtein: https://pypi.org/project/Levenshtein/
- .. versionadded:: 4.5
+ .. versionadded:: 1.3
- Added ``i18n.inconsistent_references``
+.. confval:: gettext_location
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- .. versionadded:: 7.1
+ If :code-py:`True`, Sphinx generates location information
+ for messages in message catalogs.
- Added ``index`` warning type.
+ .. versionadded:: 1.3
-.. confval:: needs_sphinx
+.. confval:: gettext_auto_build
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
- compare it with its version and refuse to build if it is too old. Default
- is no requirement.
+ If :code-py:`True`, Sphinx builds a ``.mo`` file
+ for each translation catalog file.
- .. versionadded:: 1.0
+ .. versionadded:: 1.3
- .. versionchanged:: 1.4
- also accepts micro version string
+.. confval:: gettext_additional_targets
+ :type: :code-py:`set[str] | Sequence[str]`
+ :default: :code-py:`[]`
-.. confval:: needs_extensions
+ Enable ``gettext`` translation for certain element types.
+ Example:
+
+ .. code-block:: python
- This value can be a dictionary specifying version requirements for
- extensions in :confval:`extensions`, e.g. ``needs_extensions =
- {'sphinxcontrib.something': '1.5'}``. The version strings should be in the
- form ``major.minor``. Requirements do not have to be specified for all
- extensions, only for those you want to check.
+ gettext_additional_targets = {'literal-block', 'image'}
- This requires that the extension specifies its version to Sphinx (see
- :ref:`dev-extensions` for how to do that).
+ The following element types are supported:
+
+ * :code-py:`'index'` -- index terms
+ * :code-py:`'literal-block'` -- literal blocks
+ (``::`` annotation and ``code-block`` directive)
+ * :code-py:`'doctest-block'` -- doctest block
+ * :code-py:`'raw'` -- raw content
+ * :code-py:`'image'` -- image/figure uri
.. versionadded:: 1.3
+ .. versionchanged:: 4.0
+ The alt text for images is translated by default.
+ .. versionchanged:: 7.4
+ Permit and prefer a set type.
-.. confval:: manpages_url
+.. confval:: figure_language_filename
+ :type: :code-py:`str`
+ :default: :code-py:`'{root}.{language}{ext}'`
- A URL to cross-reference :rst:role:`manpage` roles. If this is
- defined to ``https://manpages.debian.org/{path}``, the
- :literal:`:manpage:`man(1)`` role will link to
- <https://manpages.debian.org/man(1)>. The patterns available are:
+ The filename format for language-specific figures.
+ The available format tokens are:
- * ``page`` - the manual page (``man``)
- * ``section`` - the manual section (``1``)
- * ``path`` - the original manual page and section specified (``man(1)``)
+ * ``{root}``: the filename, including any path component,
+ without the file extension.
+ For example: ``images/filename``.
+ * ``{path}``: the directory path component of the filename,
+ with a trailing slash if non-empty.
+ For example: ``images/``.
+ * ``{basename}``: the filename without the directory path
+ or file extension components.
+ For example: ``filename``.
+ * ``{ext}``: the file extension.
+ For example: ``.png``.
+ * ``{language}``: the translation language.
+ For example: ``en``.
+ * ``{docpath}``: the directory path component for the current document,
+ with a trailing slash if non-empty.
+ For example: ``dirname/``.
+
+ By default, an image directive :code-rst:`.. image:: images/filename.png`,
+ using an image at :file:`images/filename.png`,
+ will use the language-specific figure filename
+ :file:`images/filename.en.png`.
+
+ If :confval:`!figure_language_filename` is set as below,
+ the language-specific figure filename will be
+ :file:`images/en/filename.png` instead.
- This also supports manpages specified as ``man.1``.
+ .. code-block:: python
- .. note:: This currently affects only HTML writers but could be
- expanded in the future.
+ figure_language_filename = '{path}{language}/{basename}{ext}'
- .. versionadded:: 1.7
+ .. versionadded:: 1.4
-.. confval:: nitpicky
+ .. versionchanged:: 1.5
+ Added ``{path}`` and ``{basename}`` tokens.
- If true, Sphinx will warn about *all* references where the target cannot be
- found. Default is ``False``. You can activate this mode temporarily using
- the :option:`-n <sphinx-build -n>` command-line switch.
+ .. versionchanged:: 3.2
+ Added ``{docpath}`` token.
- .. versionadded:: 1.0
+.. confval:: translation_progress_classes
+ :type: :code-py:`bool | 'translated' | 'untranslated'`
+ :default: :code-py:`False`
-.. confval:: nitpick_ignore
+ Control which, if any, classes are added to indicate translation progress.
+ This setting would likely only be used by translators of documentation,
+ in order to quickly indicate translated and untranslated content.
- A set or list of ``(type, target)`` tuples (by default empty) that should be
- ignored when generating warnings in "nitpicky mode". Note that ``type``
- should include the domain name if present. Example entries would be
- ``('py:func', 'int')`` or ``('envvar', 'LD_LIBRARY_PATH')``.
+ :code-py:`True`
+ Add ``translated`` and ``untranslated`` classes
+ to all nodes with translatable content.
+ :code-py:`'translated'`
+ Only add the ``translated`` class.
+ :code-py:`'untranslated'`
+ Only add the ``untranslated`` class.
+ :code-py:`False`
+ Do not add any classes to indicate translation progress.
- .. versionadded:: 1.1
- .. versionchanged:: 6.2
- Changed allowable container types to a set, list, or tuple
+ .. versionadded:: 7.1
-.. confval:: nitpick_ignore_regex
- An extended version of :confval:`nitpick_ignore`, which instead interprets
- the ``type`` and ``target`` strings as regular expressions. Note, that the
- regular expression must match the whole string (as if the ``^`` and ``$``
- markers were inserted).
+Options for markup
+------------------
- For example, ``(r'py:.*', r'foo.*bar\.B.*')`` will ignore nitpicky warnings
- for all python entities that start with ``'foo'`` and have ``'bar.B'`` in
- them, such as ``('py:const', 'foo_package.bar.BAZ_VALUE')`` or
- ``('py:class', 'food.bar.Barman')``.
+.. confval:: default_role
+ :type: :code-py:`str`
+ :default: :code-py:`None`
- .. versionadded:: 4.1
- .. versionchanged:: 6.2
- Changed allowable container types to a set, list, or tuple
+ .. index:: default; role
-.. confval:: numfig
+ The name of a reStructuredText role (builtin or Sphinx extension)
+ to use as the default role, that is, for text marked up ```like this```.
+ This can be set to :code-py:`'py:obj'` to make ```filter```
+ a cross-reference to the Python function "filter".
- If true, figures, tables and code-blocks are automatically numbered if they
- have a caption. The :rst:role:`numref` role is enabled.
- Obeyed so far only by HTML and LaTeX builders. Default is ``False``.
+ The default role can always be set within individual documents using
+ the standard reStructuredText :dudir:`default-role` directive.
- .. note::
+ .. versionadded:: 0.4
- The LaTeX builder always assigns numbers whether this option is enabled
- or not.
+.. confval:: keep_warnings
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. versionadded:: 1.3
+ Keep warnings as "system message" paragraphs in the rendered documents.
+ Warnings are always written to the standard error stream
+ when :program:`sphinx-build` is run, regardless of this setting.
-.. confval:: numfig_format
+ .. versionadded:: 0.5
- A dictionary mapping ``'figure'``, ``'table'``, ``'code-block'`` and
- ``'section'`` to strings that are used for format of figure numbers.
- As a special character, ``%s`` will be replaced to figure number.
+.. confval:: option_emphasise_placeholders
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- Default is to use ``'Fig. %s'`` for ``'figure'``, ``'Table %s'`` for
- ``'table'``, ``'Listing %s'`` for ``'code-block'`` and ``'Section %s'`` for
- ``'section'``.
+ When enabled, emphasise placeholders in :rst:dir:`option` directives.
+ To display literal braces, escape with a backslash (``\{``).
+ For example, ``option_emphasise_placeholders=True``
+ and ``.. option:: -foption={TYPE}`` would render with ``TYPE`` emphasised.
- .. versionadded:: 1.3
+ .. versionadded:: 5.1
-.. confval:: numfig_secnum_depth
+.. confval:: primary_domain
+ :type: :code-py:`str`
+ :default: :code-py:`'py'`
- - if set to ``0``, figures, tables and code-blocks are continuously numbered
- starting at ``1``.
- - if ``1`` (default) numbers will be ``x.1``, ``x.2``, ... with ``x``
- the section number (top level sectioning; no ``x.`` if no section).
- This naturally applies only if section numbering has been activated via
- the ``:numbered:`` option of the :rst:dir:`toctree` directive.
- - ``2`` means that numbers will be ``x.y.1``, ``x.y.2``, ... if located in
- a sub-section (but still ``x.1``, ``x.2``, ... if located directly under a
- section and ``1``, ``2``, ... if not in any top level section.)
- - etc...
+ .. index:: pair: default; domain
- .. versionadded:: 1.3
+ The name of the default :doc:`domain </usage/domains/index>`.
+ Can also be :code-py:`None` to disable a default domain.
+ The default is :code-py:`'py'`, for the Python domain.
- .. versionchanged:: 1.7
- The LaTeX builder obeys this setting (if :confval:`numfig` is set to
- ``True``).
+ Those objects in other domain
+ (whether the domain name is given explicitly,
+ or selected by a :rst:dir:`default-domain` directive)
+ will have the domain name explicitly prepended when named
+ (e.g., when the default domain is C,
+ Python functions will be named "Python function", not just "function").
+ Example:
-.. confval:: smartquotes
+ .. code-block:: python
- If true, the `Docutils Smart Quotes transform`__, originally based on
- `SmartyPants`__ (limited to English) and currently applying to many
- languages, will be used to convert quotes and dashes to typographically
- correct entities. Default: ``True``.
+ primary_domain = 'cpp'
- __ https://docutils.sourceforge.io/docs/user/smartquotes.html
- __ https://daringfireball.net/projects/smartypants/
+ .. versionadded:: 1.0
- .. versionadded:: 1.6.6
- It replaces deprecated :confval:`html_use_smartypants`.
- It applies by default to all builders except ``man`` and ``text``
- (see :confval:`smartquotes_excludes`.)
+.. confval:: rst_epilog
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- A `docutils.conf`__ file located in the configuration directory (or a
- global :file:`~/.docutils` file) is obeyed unconditionally if it
- *deactivates* smart quotes via the corresponding `Docutils option`__. But
- if it *activates* them, then :confval:`smartquotes` does prevail.
+ .. index:: pair: global; substitutions
- __ https://docutils.sourceforge.io/docs/user/config.html
- __ https://docutils.sourceforge.io/docs/user/config.html#smart-quotes
+ A string of reStructuredText that will be included
+ at the end of every source file that is read.
+ This is a possible place to add substitutions that
+ should be available in every file (another being :confval:`rst_prolog`).
+ Example:
-.. confval:: smartquotes_action
+ .. code-block:: python
- This string customizes the Smart Quotes transform. See the file
- :file:`smartquotes.py` at the `Docutils repository`__ for details. The
- default ``'qDe'`` educates normal **q**\ uote characters ``"``, ``'``,
- em- and en-**D**\ ashes ``---``, ``--``, and **e**\ llipses ``...``.
+ rst_epilog = """
+ .. |psf| replace:: Python Software Foundation
+ """
- .. versionadded:: 1.6.6
+ .. versionadded:: 0.6
- __ https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/
+.. confval:: rst_prolog
+ :type: :code-py:`str`
+ :default: :code-py:`''`
-.. confval:: smartquotes_excludes
+ .. index:: pair: global; substitutions
- This is a ``dict`` whose default is::
+ A string of reStructuredText that will be included
+ at the beginning of every source file that is read.
+ This is a possible place to add substitutions that
+ should be available in every file (another being :confval:`rst_epilog`).
+ Example:
- {'languages': ['ja'], 'builders': ['man', 'text']}
+ .. code-block:: python
- Each entry gives a sufficient condition to ignore the
- :confval:`smartquotes` setting and deactivate the Smart Quotes transform.
- Accepted keys are as above ``'builders'`` or ``'languages'``.
- The values are lists.
+ rst_prolog = """
+ .. |psf| replace:: Python Software Foundation
+ """
- .. note:: Currently, in case of invocation of :program:`make` with multiple
- targets, the first target name is the only one which is tested against
- the ``'builders'`` entry and it decides for all. Also, a ``make text``
- following ``make html`` needs to be issued in the form ``make text
- O="-E"`` to force re-parsing of source files, as the cached ones are
- already transformed. On the other hand the issue does not arise with
- direct usage of :program:`sphinx-build` as it caches
- (in its default usage) the parsed source files in per builder locations.
+ .. versionadded:: 1.0
- .. hint:: An alternative way to effectively deactivate (or customize) the
- smart quotes for a given builder, for example ``latex``, is to use
- ``make`` this way:
+.. confval:: show_authors
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. code-block:: console
+ A boolean that decides whether :rst:dir:`codeauthor` and
+ :rst:dir:`sectionauthor` directives produce any output in the built files.
- make latex O="-D smartquotes_action="
+.. confval:: trim_footnote_reference_space
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- This can follow some ``make html`` with no problem, in contrast to the
- situation from the prior note.
+ Trim spaces before footnote references that are
+ necessary for the reStructuredText parser to recognise the footnote,
+ but do not look too nice in the output.
- .. versionadded:: 1.6.6
+ .. versionadded:: 0.6
-.. confval:: user_agent
- A User-Agent of Sphinx. It is used for a header on HTTP access (ex.
- linkcheck, intersphinx and so on). Default is ``"Sphinx/X.Y.Z
- requests/X.Y.Z python/X.Y.Z"``.
+.. _math-options:
- .. versionadded:: 2.3
+Options for Maths
+-----------------
-.. confval:: tls_verify
+These options control maths markup and notation.
- If true, Sphinx verifies server certifications. Default is ``True``.
+.. confval:: math_eqref_format
+ :type: :code-py:`str`
+ :default: :code-py:`'({number})'`
- .. versionadded:: 1.5
+ A string used for formatting the labels of references to equations.
+ The ``{number}`` place-holder stands for the equation number.
-.. confval:: tls_cacerts
+ Example: ``'Eq.{number}'`` gets rendered as, for example, ``Eq.10``.
- A path to a certification file of CA or a path to directory which
- contains the certificates. This also allows a dictionary mapping
- hostname to the path to certificate file.
- The certificates are used to verify server certifications.
+ .. versionadded:: 1.7
- .. versionadded:: 1.5
+.. confval:: math_number_all
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. tip:: Sphinx uses requests_ as a HTTP library internally.
- Therefore, Sphinx refers a certification file on the
- directory pointed ``REQUESTS_CA_BUNDLE`` environment
- variable if ``tls_cacerts`` not set.
+ Force all displayed equations to be numbered.
+ Example:
- .. _requests: https://requests.readthedocs.io/en/master/
+ .. code-block:: python
-.. confval:: today
- today_fmt
+ math_number_all = True
- These values determine how to format the current date, used as the
- replacement for ``|today|``.
+ .. versionadded:: 1.4
- * If you set :confval:`today` to a non-empty value, it is used.
- * Otherwise, the current time is formatted using :func:`time.strftime` and
- the format given in :confval:`today_fmt`.
+.. confval:: math_numfig
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- The default is now :confval:`today` and a :confval:`today_fmt` of ``'%b %d,
- %Y'`` (or, if translation is enabled with :confval:`language`, an equivalent
- format for the selected locale).
+ If :code-py:`True`, displayed math equations are numbered across pages
+ when :confval:`numfig` is enabled.
+ The :confval:`numfig_secnum_depth` setting is respected.
+ The :rst:role:`eq`, not :rst:role:`numref`, role
+ must be used to reference equation numbers.
-.. confval:: highlight_language
+ .. versionadded:: 1.7
- The default language to highlight source code in. The default is
- ``'default'``. It is similar to ``'python3'``; it is mostly a superset of
- ``'python'`` but it fallbacks to ``'none'`` without warning if failed.
- ``'python3'`` and other languages will emit warning if failed.
+.. confval:: math_numsep
+ :type: :code-py:`str`
+ :default: :code-py:`'.'`
- The value should be a valid Pygments lexer name, see
- :ref:`code-examples` for more details.
+ A string that defines the separator between section numbers
+ and the equation number when :confval:`numfig` is enabled and
+ :confval:`numfig_secnum_depth` is positive.
- .. versionadded:: 0.5
+ Example: :code-py:`'-'` gets rendered as ``1.2-3``.
- .. versionchanged:: 1.4
- The default is now ``'default'``. If you prefer Python 2 only
- highlighting, you can set it back to ``'python'``.
+ .. versionadded:: 7.4
-.. confval:: highlight_options
- A dictionary that maps language names to options for the lexer modules of
- Pygments. These are lexer-specific; for the options understood by each,
- see the `Pygments documentation <https://pygments.org/docs/lexers>`_.
+Options for the nitpicky mode
+-----------------------------
- Example::
+.. confval:: nitpicky
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- highlight_options = {
- 'default': {'stripall': True},
- 'php': {'startinline': True},
- }
+ Enables nitpicky mode if :code-py:`True`.
+ In nitpicky mode, Sphinx will warn about *all* references
+ where the target cannot be found.
+ This is recommended for new projects as it ensures that all references
+ are to valid targets.
- A single dictionary of options are also allowed. Then it is recognized
- as options to the lexer specified by :confval:`highlight_language`::
+ You can activate this mode temporarily using
+ the :option:`--nitpicky <sphinx-build --nitpicky>` command-line option.
+ See :confval:`nitpick_ignore` for a way to mark missing references
+ as "known missing".
- # configuration for the ``highlight_language``
- highlight_options = {'stripall': True}
+ .. code-block:: python
- .. versionadded:: 1.3
- .. versionchanged:: 3.5
+ nitpicky = True
- Allow to configure highlight options for multiple languages
+ .. versionadded:: 1.0
-.. confval:: pygments_style
+.. confval:: nitpick_ignore
+ :type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
+ :default: :code-py:`()`
- The style name to use for Pygments highlighting of source code. If not set,
- either the theme's default style or ``'sphinx'`` is selected for HTML
- output.
+ A set or list of :code-py:`(warning_type, target)` tuples
+ that should be ignored when generating warnings
+ in :confval:`"nitpicky mode" <nitpicky>`.
+ Note that ``warning_type`` should include the domain name if present.
+ Example:
- .. versionchanged:: 0.3
- If the value is a fully-qualified name of a custom Pygments style class,
- this is then used as custom style.
+ .. code-block:: python
-.. confval:: maximum_signature_line_length
+ nitpick_ignore = {
+ ('py:func', 'int'),
+ ('envvar', 'LD_LIBRARY_PATH'),
+ }
- If a signature's length in characters exceeds the number set, each
- parameter within the signature will be displayed on an individual logical
- line.
+ .. versionadded:: 1.1
+ .. versionchanged:: 6.2
+ Changed allowable container types to a set, list, or tuple
- When ``None`` (the default), there is no maximum length and the entire
- signature will be displayed on a single logical line.
+.. confval:: nitpick_ignore_regex
+ :type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
+ :default: :code-py:`()`
- A 'logical line' is similar to a hard line break---builders or themes may
- choose to 'soft wrap' a single logical line, and this setting does not affect
- that behaviour.
+ An extended version of :confval:`nitpick_ignore`,
+ which instead interprets the ``warning_type`` and ``target`` strings
+ as regular expressions.
+ Note that the regular expression must match the whole string
+ (as if the ``^`` and ``$`` markers were inserted).
- Domains may provide options to suppress any hard wrapping on an individual
- object directive, such as seen in the C, C++, and Python domains (e.g.
- :rst:dir:`py:function:single-line-parameter-list`).
+ For example, ``(r'py:.*', r'foo.*bar\.B.*')`` will ignore nitpicky warnings
+ for all python entities that start with ``'foo'``
+ and have ``'bar.B'`` in them,
+ such as :code-py:`('py:const', 'foo_package.bar.BAZ_VALUE')`
+ or :code-py:`('py:class', 'food.bar.Barman')`.
- .. versionadded:: 7.1
+ .. versionadded:: 4.1
+ .. versionchanged:: 6.2
+ Changed allowable container types to a set, list, or tuple
+
+
+Options for object signatures
+-----------------------------
.. confval:: add_function_parentheses
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
A boolean that decides whether parentheses are appended to function and
method role text (e.g. the content of ``:func:`input```) to signify that the
- name is callable. Default is ``True``.
+ name is callable.
-.. confval:: add_module_names
+.. confval:: maximum_signature_line_length
+ :type: :code-py:`int | None`
+ :default: :code-py:`None`
- A boolean that decides whether module names are prepended to all
- :term:`object` names (for object types where a "module" of some kind is
- defined), e.g. for :rst:dir:`py:function` directives. Default is ``True``.
+ If a signature's length in characters exceeds the number set,
+ each parameter within the signature will be displayed on
+ an individual logical line.
-.. confval:: toc_object_entries
+ When :code-py:`None`, there is no maximum length and the entire
+ signature will be displayed on a single logical line.
- Create table of contents entries for domain objects (e.g. functions, classes,
- attributes, etc.). Default is ``True``.
+ A 'logical line' is similar to a hard line break---builders or themes
+ may choose to 'soft wrap' a single logical line,
+ and this setting does not affect that behaviour.
-.. confval:: toc_object_entries_show_parents
+ Domains may provide options to suppress any hard wrapping
+ on an individual object directive,
+ such as seen in the C, C++, and Python domains
+ (e.g. :rst:dir:`py:function:single-line-parameter-list`).
- A string that determines how domain objects (e.g. functions, classes,
- attributes, etc.) are displayed in their table of contents entry.
+ .. versionadded:: 7.1
+
+.. confval:: strip_signature_backslash
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
+
+ When backslash stripping is enabled then every occurrence of ``\\`` in a
+ domain directive will be changed to ``\``, even within string literals.
+ This was the behaviour before version 3.0, and setting this variable to
+ :code-py:`True` will reinstate that behaviour.
- Use ``domain`` to allow the domain to determine the appropriate number of
- parents to show. For example, the Python domain would show ``Class.method()``
- and ``function()``, leaving out the ``module.`` level of parents.
- This is the default setting.
+ .. versionadded:: 3.0
- Use ``hide`` to only show the name of the element without any parents
- (i.e. ``method()``).
+.. confval:: toc_object_entries
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- Use ``all`` to show the fully-qualified name for the object
- (i.e. ``module.Class.method()``), displaying all parents.
+ Create table of contents entries for domain objects
+ (e.g. functions, classes, attributes, etc.).
.. versionadded:: 5.2
-.. confval:: show_authors
+.. confval:: toc_object_entries_show_parents
+ :type: :code-py:`'domain' | 'hide' | 'all'`
+ :default: :code-py:`'domain'`
- A boolean that decides whether :rst:dir:`codeauthor` and
- :rst:dir:`sectionauthor` directives produce any output in the built files.
+ A string that determines how domain objects
+ (functions, classes, attributes, etc.)
+ are displayed in their table of contents entry.
-.. confval:: modindex_common_prefix
+ Use :code-py:`'domain'` to allow the domain to determine
+ the appropriate number of parents to show.
+ For example, the Python domain would show :code-py:`Class.method()`
+ and :code-py:`function()`,
+ leaving out the :code-py:`module.` level of parents.
- A list of prefixes that are ignored for sorting the Python module index
- (e.g., if this is set to ``['foo.']``, then ``foo.bar`` is shown under ``B``,
- not ``F``). This can be handy if you document a project that consists of a
- single package. Works only for the HTML builder currently. Default is
- ``[]``.
+ Use :code-py:`'hide'` to only show the name of the element
+ without any parents (i.e. :code-py:`method()`).
- .. versionadded:: 0.6
+ Use :code-py:`'all'` to show the fully-qualified name for the object
+ (i.e. :code-py:`module.Class.method()`), displaying all parents.
-.. confval:: trim_footnote_reference_space
+ .. versionadded:: 5.2
- Trim spaces before footnote references that are necessary for the reST
- parser to recognize the footnote, but do not look too nice in the output.
- .. versionadded:: 0.6
+Options for source files
+------------------------
-.. confval:: trim_doctest_flags
+.. confval:: exclude_patterns
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- If true, doctest flags (comments looking like ``# doctest: FLAG, ...``) at
- the ends of lines and ``<BLANKLINE>`` markers are removed for all code
- blocks showing interactive Python sessions (i.e. doctests). Default is
- ``True``. See the extension :mod:`~sphinx.ext.doctest` for more
- possibilities of including doctests.
+ A list of `glob-style patterns`_ that should be excluded when looking for
+ source files.
+ They are matched against the source file names
+ relative to the source directory,
+ using slashes as directory separators on all platforms.
+ :confval:`exclude_patterns` has priority over :confval:`include_patterns`.
- .. versionadded:: 1.0
- .. versionchanged:: 1.1
- Now also removes ``<BLANKLINE>``.
+ Example patterns:
-.. confval:: strip_signature_backslash
+ * :code-py:`'library/xml.rst'` -- ignores the ``library/xml.rst`` file
+ * :code-py:`'library/xml'` -- ignores the ``library/xml`` directory
+ * :code-py:`'library/xml*'` -- ignores all files and directories starting with
+ :code-py:`library/xml`
+ * :code-py:`'**/.git'` -- ignores all ``.git`` directories
+ * :code-py:`'Thumbs.db'` -- ignores all ``Thumbs.db`` files
- Default is ``False``.
- When backslash stripping is enabled then every occurrence of ``\\`` in a
- domain directive will be changed to ``\``, even within string literals.
- This was the behaviour before version 3.0, and setting this variable to
- ``True`` will reinstate that behaviour.
+ :confval:`exclude_patterns` is also consulted when looking for static files
+ in :confval:`html_static_path` and :confval:`html_extra_path`.
- .. versionadded:: 3.0
+ .. versionadded:: 1.0
-.. confval:: option_emphasise_placeholders
+.. confval:: include_patterns
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`('**',)`
- Default is ``False``.
- When enabled, emphasise placeholders in :rst:dir:`option` directives.
- To display literal braces, escape with a backslash (``\{``). For example,
- ``option_emphasise_placeholders=True`` and ``.. option:: -foption={TYPE}`` would
- render with ``TYPE`` emphasised.
+ A list of `glob-style patterns`_ that are used to find source files.
+ They are matched against the source file
+ names relative to the source directory,
+ using slashes as directory separators on all platforms.
+ By default, all files are recursively included from the source directory.
+ :confval:`exclude_patterns` has priority over :confval:`include_patterns`.
+
+ Example patterns:
+
+ * :code-py:`'**'` -- all files in the source directory and subdirectories,
+ recursively
+ * :code-py:`'library/xml'` -- just the ``library/xml`` directory
+ * :code-py:`'library/xml*'` -- all files and directories starting with
+ ``library/xml``
+ * :code-py:`'**/doc'` -- all ``doc`` directories (this might be useful if
+ documentation is co-located with source files)
.. versionadded:: 5.1
-.. _intl-options:
+.. confval:: master_doc
+ root_doc
+ :type: :code-py:`str`
+ :default: :code-py:`'index'`
+
+ Sphinx builds a tree of documents based on the :rst:dir:`toctree` directives
+ contained within the source files.
+ This sets the name of the document containing the master ``toctree`` directive,
+ and hence the root of the entire tree.
+ Example:
-Options for internationalization
---------------------------------
+ .. code-block:: python
-These options influence Sphinx's *Native Language Support*. See the
-documentation on :ref:`intl` for details.
+ master_doc = 'contents'
-.. confval:: language
+ .. versionchanged:: 2.0
+ Default is :code-py:`'index'` (previously :code-py:`'contents'`).
- The code for the language the docs are written in. Any text automatically
- generated by Sphinx will be in that language. Also, Sphinx will try to
- substitute individual paragraphs from your documents with the translation
- sets obtained from :confval:`locale_dirs`. Sphinx will search
- language-specific figures named by :confval:`figure_language_filename`
- (e.g. the German version of ``myfigure.png`` will be ``myfigure.de.png``
- by default setting) and substitute them for original figures. In the LaTeX
- builder, a suitable language will be selected as an option for the *Babel*
- package. Default is ``'en'``.
+ .. versionadded:: 4.0
+ The :confval:`!root_doc` alias.
+
+.. confval:: source_encoding
+ :type: :code-py:`str`
+ :default: :code-py:`'utf-8-sig'`
+
+ The file encoding of all source files.
+ The recommended encoding is ``'utf-8-sig'``.
.. versionadded:: 0.5
- .. versionchanged:: 1.4
+.. confval:: source_suffix
+ :type: :code-py:`dict[str, str] | Sequence[str] | str`
+ :default: :code-py:`{'.rst': 'restructuredtext'}`
- Support figure substitution
+ A dictionary mapping the file extensions (suffixes)
+ of source files to their file types.
+ Sphinx considers all files files with suffixes in :code-py:`source_suffix`
+ to be source files.
+ Example:
- .. versionchanged:: 5.0
+ .. code-block:: python
- Currently supported languages by Sphinx are:
+ source_suffix = {
+ '.rst': 'restructuredtext',
+ '.txt': 'restructuredtext',
+ '.md': 'markdown',
+ }
- * ``ar`` -- Arabic
- * ``bg`` -- Bulgarian
- * ``bn`` -- Bengali
- * ``ca`` -- Catalan
- * ``cak`` -- Kaqchikel
- * ``cs`` -- Czech
- * ``cy`` -- Welsh
- * ``da`` -- Danish
- * ``de`` -- German
- * ``el`` -- Greek
- * ``en`` -- English (default)
- * ``eo`` -- Esperanto
- * ``es`` -- Spanish
- * ``et`` -- Estonian
- * ``eu`` -- Basque
- * ``fa`` -- Iranian
- * ``fi`` -- Finnish
- * ``fr`` -- French
- * ``he`` -- Hebrew
- * ``hi`` -- Hindi
- * ``hi_IN`` -- Hindi (India)
- * ``hr`` -- Croatian
- * ``hu`` -- Hungarian
- * ``id`` -- Indonesian
- * ``it`` -- Italian
- * ``ja`` -- Japanese
- * ``ko`` -- Korean
- * ``lt`` -- Lithuanian
- * ``lv`` -- Latvian
- * ``mk`` -- Macedonian
- * ``nb_NO`` -- Norwegian Bokmal
- * ``ne`` -- Nepali
- * ``nl`` -- Dutch
- * ``pl`` -- Polish
- * ``pt`` -- Portuguese
- * ``pt_BR`` -- Brazilian Portuguese
- * ``pt_PT`` -- European Portuguese
- * ``ro`` -- Romanian
- * ``ru`` -- Russian
- * ``si`` -- Sinhala
- * ``sk`` -- Slovak
- * ``sl`` -- Slovenian
- * ``sq`` -- Albanian
- * ``sr`` -- Serbian
- * ``sr@latin`` -- Serbian (Latin)
- * ``sr_RS`` -- Serbian (Cyrillic)
- * ``sv`` -- Swedish
- * ``ta`` -- Tamil
- * ``te`` -- Telugu
- * ``tr`` -- Turkish
- * ``uk_UA`` -- Ukrainian
- * ``ur`` -- Urdu
- * ``vi`` -- Vietnamese
- * ``zh_CN`` -- Simplified Chinese
- * ``zh_TW`` -- Traditional Chinese
+ By default, Sphinx only supports the :code-py:`'restructuredtext'` file type.
+ Further file types can be added with extensions that register different
+ source file parsers, such as `MyST-Parser`_.
+ Refer to the extension's documentation to see which file types it supports.
-.. confval:: locale_dirs
+ .. _MyST-Parser: https://myst-parser.readthedocs.io/
- .. versionadded:: 0.5
+ If the value is a string or sequence of strings,
+ Sphinx will consider that they are all :code-py:`'restructuredtext'` files.
- Directories in which to search for additional message catalogs (see
- :confval:`language`), relative to the source directory. The directories on
- this path are searched by the standard :mod:`gettext` module.
+ .. note:: File extensions must begin with a dot (``'.'``).
- Internal messages are fetched from a text domain of ``sphinx``; so if you
- add the directory :file:`./locale` to this setting, the message catalogs
- (compiled from ``.po`` format using :program:`msgfmt`) must be in
- :file:`./locale/{language}/LC_MESSAGES/sphinx.mo`. The text domain of
- individual documents depends on :confval:`gettext_compact`.
+ .. versionchanged:: 1.3
+ Support a list of file extensions.
- The default is ``['locales']``.
+ .. versionchanged:: 1.8
+ Change to a map of file extensions to file types.
- .. note:: The :option:`-v option for sphinx-build command <sphinx-build -v>`
- is useful to check the locale_dirs config works as expected. It
- emits debug messages if message catalog directory not found.
- .. versionchanged:: 1.5
- Use ``locales`` directory as a default value
+Options for smart quotes
+------------------------
-.. confval:: gettext_allow_fuzzy_translations
+.. confval:: smartquotes
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, "fuzzy" messages in the message catalogs are used for translation.
- The default is ``False``.
+ If :code-py:`True`, the `Smart Quotes transform`__
+ will be used to convert quotation marks and dashes
+ to typographically correct entities.
- .. versionadded:: 4.3
+ __ https://docutils.sourceforge.io/docs/user/smartquotes.html
-.. confval:: gettext_compact
+ .. versionadded:: 1.6.6
+ Replaces the now-removed :confval:`!html_use_smartypants`.
+ It applies by default to all builders except ``man`` and ``text``
+ (see :confval:`smartquotes_excludes`.)
- .. versionadded:: 1.1
+ .. note::
- If true, a document's text domain is its docname if it is a top-level
- project file and its very base directory otherwise.
+ A `docutils.conf`__ file located in the :term:`configuration directory`
+ (or a global :file:`~/.docutils` file) is obeyed unconditionally if it
+ *deactivates* smart quotes via the corresponding `Docutils option`__.
+ But if it *activates* them, then :confval:`smartquotes` does prevail.
- If set to string, all document's text domain is this string, making all
- documents use single text domain.
+ __ https://docutils.sourceforge.io/docs/user/config.html
+ __ https://docutils.sourceforge.io/docs/user/config.html#smart-quotes
- By default, the document ``markup/code.rst`` ends up in the ``markup`` text
- domain. With this option set to ``False``, it is ``markup/code``.
+.. confval:: smartquotes_action
+ :type: :code-py:`str`
+ :default: :code-py:`'qDe'`
+
+ Customise the Smart Quotes transform.
+ See below for the permitted codes.
+ The default :code-py:`'qDe'` educates
+ normal **q**\ uote characters ``"``, ``'``,
+ em- and en-**D**\ ashes ``---``, ``--``,
+ and **e**\ llipses ``...``..
+
+ :code-py:`'q'`
+ Convert quotation marks
+ :code-py:`'b'`
+ Convert backtick quotation marks
+ (:literal:`\`\`double''` only)
+ :code-py:`'B'`
+ Convert backtick quotation marks
+ (:literal:`\`\`double''` and :literal:`\`single'`)
+ :code-py:`'d'`
+ Convert dashes
+ (convert ``--`` to em-dashes and ``---`` to en-dashes)
+ :code-py:`'D'`
+ Convert dashes (old school)
+ (convert ``--`` to en-dashes and ``---`` to em-dashes)
+ :code-py:`'i'`
+ Convert dashes (inverted old school)
+ (convert ``--`` to em-dashes and ``---`` to en-dashes)
+ :code-py:`'e'`
+ Convert ellipses ``...``
+ :code-py:`'w'`
+ Convert ``'&quot;'`` entities to ``'"'``
- .. versionchanged:: 3.3
- The string value is now accepted.
+ .. versionadded:: 1.6.6
-.. confval:: gettext_uuid
+.. confval:: smartquotes_excludes
+ :type: :code-py:`dict[str, list[str]]`
+ :default: :code-py:`{'languages': ['ja'], 'builders': ['man', 'text']}`
- If true, Sphinx generates uuid information for version tracking in message
- catalogs. It is used for:
+ Control when the Smart Quotes transform is disabled.
+ Permitted keys are :code-py:`'builders'` and :code-py:`'languages'`, and
+ The values are lists of strings.
- * Add uid line for each msgids in .pot files.
- * Calculate similarity between new msgids and previously saved old msgids.
- This calculation takes a long time.
+ Each entry gives a sufficient condition to ignore the
+ :confval:`smartquotes` setting and deactivate the Smart Quotes transform.
+ Example:
- If you want to accelerate the calculation, you can use
- ``python-levenshtein`` 3rd-party package written in C by using
- :command:`pip install python-levenshtein`.
+ .. code-block:: python
- The default is ``False``.
+ smartquotes_excludes = {
+ 'languages': ['ja'],
+ 'builders': ['man', 'text'],
+ }
- .. versionadded:: 1.3
+ .. note::
-.. confval:: gettext_location
+ Currently, in case of invocation of :program:`make` with multiple
+ targets, the first target name is the only one which is tested against
+ the :code-py:`'builders'` entry and it decides for all.
+ Also, a ``make text`` following ``make html`` needs to be issued
+ in the form ``make text SPHINXOPTS="-E"`` to force re-parsing
+ of source files, as the cached ones are already transformed.
+ On the other hand the issue does not arise with
+ direct usage of :program:`sphinx-build` as it caches
+ (in its default usage) the parsed source files in per builder locations.
- If true, Sphinx generates location information for messages in message
- catalogs.
+ .. hint::
- The default is ``True``.
+ An alternative way to effectively deactivate (or customise) the
+ smart quotes for a given builder, for example ``latex``,
+ is to use ``make`` this way:
- .. versionadded:: 1.3
+ .. code-block:: console
-.. confval:: gettext_auto_build
+ make latex SPHINXOPTS="-D smartquotes_action="
- If true, Sphinx builds mo file for each translation catalog files.
+ This can follow some ``make html`` with no problem, in contrast to the
+ situation from the prior note.
- The default is ``True``.
+ .. versionadded:: 1.6.6
- .. versionadded:: 1.3
-.. confval:: gettext_additional_targets
+Options for templating
+----------------------
- To specify names to enable gettext extracting and translation applying for
- i18n additionally. You can specify below names:
+.. confval:: template_bridge
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- :index: index terms
- :literal-block: literal blocks (``::`` annotation and ``code-block`` directive)
- :doctest-block: doctest block
- :raw: raw content
- :image: image/figure uri
+ A string with the fully-qualified name of a callable (or simply a class)
+ that returns an instance of :class:`~sphinx.application.TemplateBridge`.
+ This instance is then used to render HTML documents,
+ and possibly the output of other builders (currently the changes builder).
+ (Note that the template bridge must be made theme-aware
+ if HTML themes are to be used.)
+ Example:
- For example: ``gettext_additional_targets = ['literal-block', 'image']``.
+ .. code-block:: python
- The default is ``[]``.
+ template_bridge = 'module.CustomTemplateBridge'
- .. versionadded:: 1.3
- .. versionchanged:: 4.0
+.. confval:: templates_path
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- The alt text for image is translated by default.
+ A list of paths that contain extra templates
+ (or templates that overwrite builtin/theme-specific templates).
+ Relative paths are taken as relative to the :term:`configuration directory`.
+ Example:
-.. confval:: figure_language_filename
+ .. code-block:: python
- The filename format for language-specific figures. The default value is
- ``{root}.{language}{ext}``. It will be expanded to
- ``dirname/filename.en.png`` from ``.. image:: dirname/filename.png``.
- The available format tokens are:
+ templates_path = ['.templates']
- * ``{root}`` - the filename, including any path component, without the file
- extension, e.g. ``dirname/filename``
- * ``{path}`` - the directory path component of the filename, with a trailing
- slash if non-empty, e.g. ``dirname/``
- * ``{docpath}`` - the directory path component for the current document, with
- a trailing slash if non-empty.
- * ``{basename}`` - the filename without the directory path or file extension
- components, e.g. ``filename``
- * ``{ext}`` - the file extension, e.g. ``.png``
- * ``{language}`` - the translation language, e.g. ``en``
+ .. versionchanged:: 1.3
+ As these files are not meant to be built,
+ they are automatically excluded when discovering source files.
- For example, setting this to ``{path}{language}/{basename}{ext}`` will
- expand to ``dirname/en/filename.png`` instead.
- .. versionadded:: 1.4
+Options for warning control
+---------------------------
- .. versionchanged:: 1.5
- Added ``{path}`` and ``{basename}`` tokens.
+.. confval:: show_warning_types
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- .. versionchanged:: 3.2
- Added ``{docpath}`` token.
+ Add the type of each warning as a suffix to the warning message.
+ For example, ``WARNING: [...] [index]`` or ``WARNING: [...] [toc.circular]``.
+ This setting can be useful for determining which warnings types to include
+ in a :confval:`suppress_warnings` list.
-.. confval:: translation_progress_classes
+ .. versionadded:: 7.3.0
- Control which, if any, classes are added to indicate translation progress.
- This setting would likely only be used by translators of documentation,
- in order to quickly indicate translated and untranslated content.
+.. confval:: suppress_warnings
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- * ``True``: add ``translated`` and ``untranslated`` classes
- to all nodes with translatable content.
- * ``translated``: only add the ``translated`` class.
- * ``untranslated``: only add the ``untranslated`` class.
- * ``False``: do not add any classes to indicate translation progress.
+ A list of warning codes to suppress arbitrary warning messages.
- Defaults to ``False``.
+ By default, Sphinx supports the following warning codes:
- .. versionadded:: 7.1
+ * ``app.add_node``
+ * ``app.add_directive``
+ * ``app.add_role``
+ * ``app.add_generic_role``
+ * ``app.add_source_parser``
+ * ``config.cache``
+ * ``docutils``
+ * ``download.not_readable``
+ * ``epub.unknown_project_files``
+ * ``epub.duplicated_toc_entry``
+ * ``i18n.inconsistent_references``
+ * ``index``
+ * ``image.not_readable``
+ * ``ref.term``
+ * ``ref.ref``
+ * ``ref.numref``
+ * ``ref.keyword``
+ * ``ref.option``
+ * ``ref.citation``
+ * ``ref.footnote``
+ * ``ref.doc``
+ * ``ref.python``
+ * ``misc.highlighting_failure``
+ * ``toc.circular``
+ * ``toc.excluded``
+ * ``toc.no_title``
+ * ``toc.not_readable``
+ * ``toc.secnum``
-.. _math-options:
+ Extensions can also define their own warning types.
+ Those defined by the first-party ``sphinx.ext`` extensions are:
-Options for Math
-----------------
+ * ``autodoc``
+ * ``autodoc.import_object``
+ * ``autosectionlabel.<document name>``
+ * ``autosummary``
+ * ``autosummary.import_cycle``
+ * ``intersphinx.external``
-These options influence Math notations.
+ You can choose from these types. You can also give only the first
+ component to exclude all warnings attached to it.
-.. confval:: math_number_all
+ .. versionadded:: 1.4
- Set this option to ``True`` if you want all displayed math to be numbered.
- The default is ``False``.
+ .. versionchanged:: 1.5
+ Added ``misc.highlighting_failure``
-.. confval:: math_eqref_format
+ .. versionchanged:: 1.5.1
+ Added ``epub.unknown_project_files``
- A string used for formatting the labels of references to equations.
- The ``{number}`` place-holder stands for the equation number.
+ .. versionchanged:: 1.6
+ Added ``ref.footnote``
- Example: ``'Eq.{number}'`` gets rendered as, for example, ``Eq.10``.
+ .. versionchanged:: 2.1
+ Added ``autosectionlabel.<document name>``
-.. confval:: math_numfig
+ .. versionchanged:: 3.3.0
+ Added ``epub.duplicated_toc_entry``
- If ``True``, displayed math equations are numbered across pages when
- :confval:`numfig` is enabled. The :confval:`numfig_secnum_depth` setting
- is respected. The :rst:role:`eq`, not :rst:role:`numref`, role
- must be used to reference equation numbers. Default is ``True``.
+ .. versionchanged:: 4.3
+ Added ``toc.excluded`` and ``toc.not_readable``
- .. versionadded:: 1.7
+ .. versionadded:: 4.5
+ Added ``i18n.inconsistent_references``
+
+ .. versionadded:: 7.1
+ Added ``index``.
+
+ .. versionadded:: 7.3
+ Added ``config.cache``.
+
+ .. versionadded:: 7.3
+ Added ``toc.no_title``.
+
+
+Builder options
+===============
.. _html-options:
@@ -1052,186 +1432,243 @@ These options influence Math notations.
Options for HTML output
-----------------------
-These options influence HTML as well as HTML Help output, and other builders
-that use Sphinx's HTMLWriter class.
+These options influence HTML output.
+Various other builders are derived from the HTML output,
+and also make use of these options.
.. confval:: html_theme
+ :type: :code-py:`str`
+ :default: :code-py:`'alabaster'`
- The "theme" that the HTML output should use. See the :doc:`section about
- theming </usage/theming>`. The default is ``'alabaster'``.
+ The theme for HTML output.
+ See the :doc:`HTML theming section </usage/theming>`.
.. versionadded:: 0.6
+ .. versionchanged:: 1.3
+ The default theme is now :code-py:`'alabaster'`.
.. confval:: html_theme_options
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary of options that influence the look and feel of the selected
- theme. These are theme-specific. For the options understood by the builtin
- themes, see :ref:`this section <builtin-themes>`.
+ A dictionary of options that influence the
+ look and feel of the selected theme.
+ These are theme-specific.
+ The options understood by the :ref:`builtin themes
+ <builtin-themes>` are described :ref:`here <builtin-themes>`.
.. versionadded:: 0.6
.. confval:: html_theme_path
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
- A list of paths that contain custom themes, either as subdirectories or as
- zip files. Relative paths are taken as relative to the configuration
- directory.
+ A list of paths that contain custom themes,
+ either as subdirectories or as zip files.
+ Relative paths are taken as relative to the :term:`configuration directory`.
.. versionadded:: 0.6
.. confval:: html_style
+ :type: :code-py:`Sequence[str] | str`
+ :default: :code-py:`()`
+
+ Stylesheets to use for HTML pages.
+ The stylesheet given by the selected theme is used by default
+ A file of that name must exist either in Sphinx's :file:`static/` path
+ or in one of the custom paths given in :confval:`html_static_path`.
+ If you only want to add or override a few things from the theme,
+ use CSS ``@import`` to import the theme's stylesheet.
- The style sheet to use for HTML pages. A file of that name must exist
- either in Sphinx's :file:`static/` path, or in one of the custom paths given
- in :confval:`html_static_path`. Default is the stylesheet given by the
- selected theme. If you only want to add or override a few things compared
- to the theme's stylesheet, use CSS ``@import`` to import the theme's
- stylesheet.
+ .. versionchanged:: 5.1
+ The value can be a iterable of strings.
.. confval:: html_title
+ :type: :code-py:`str`
+ :default: :samp:`'{project} {release} documentation'`
The "title" for HTML documentation generated with Sphinx's own templates.
- This is appended to the ``<title>`` tag of individual pages, and used in the
- navigation bar as the "topmost" element. It defaults to :samp:`'{<project>}
- v{<revision>} documentation'`.
+ This is appended to the ``<title>`` tag of individual pages,
+ and used in the navigation bar as the "topmost" element.
.. confval:: html_short_title
+ :type: :code-py:`str`
+ :default: The value of **html_title**
- A shorter "title" for the HTML docs. This is used for links in the
- header and in the HTML Help docs. If not given, it defaults to the value of
- :confval:`html_title`.
+ A shorter "title" for HTML documentation.
+ This is used for links in the header and in the HTML Help documentation.
.. versionadded:: 0.4
.. confval:: html_baseurl
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- The base URL which points to the root of the HTML documentation. It is used
- to indicate the location of document using `The Canonical Link Relation`_.
- Default: ``''``.
-
- .. _The Canonical Link Relation: https://datatracker.ietf.org/doc/html/rfc6596
+ The base URL which points to the root of the HTML documentation.
+ It is used to indicate the location of document using
+ :rfc:`the Canonical Link Relation <6596>`.
.. versionadded:: 1.8
.. confval:: html_codeblock_linenos_style
+ :type: :code-py:`'inline' | 'table'`
+ :default: :code-py:`'inline'`
The style of line numbers for code-blocks.
- * ``'table'`` -- display line numbers using ``<table>`` tag
- * ``'inline'`` -- display line numbers using ``<span>`` tag (default)
+ :code-py:`'table'`
+ Display line numbers using ``<table>`` tag
+ :code-py:`'inline'`
+ Display line numbers using ``<span>`` tag
.. versionadded:: 3.2
.. versionchanged:: 4.0
-
- It defaults to ``'inline'``.
-
+ It defaults to :code-py:`'inline'`.
.. deprecated:: 4.0
.. confval:: html_context
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary of values to pass into the template engine's context for all
- pages. Single values can also be put in this dictionary using the
- :option:`-A <sphinx-build -A>` command-line option of ``sphinx-build``.
+ A dictionary of values to pass into
+ the template engine's context for all pages.
+ Single values can also be put in this dictionary using
+ :program:`sphinx-build`'s :option:`--html-define
+ <sphinx-build --html-define>` command-line option.
.. versionadded:: 0.5
.. confval:: html_logo
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- If given, this must be the name of an image file (path relative to the
- :term:`configuration directory`) that is the logo of the docs, or URL that
- points an image file for the logo. It is placed at the top of the sidebar;
- its width should therefore not exceed 200 pixels. Default: ``None``.
+ If given, this must be the name of an image file
+ (path relative to the :term:`configuration directory`)
+ that is the logo of the documentation,
+ or a URL that points an image file for the logo.
+ It is placed at the top of the sidebar;
+ its width should therefore not exceed 200 pixels.
.. versionadded:: 0.4.1
- The image file will be copied to the ``_static`` directory of the output
- HTML, but only if the file does not already exist there.
-
+ The image file will be copied to the ``_static`` directory,
+ but only if the file does not already exist there.
.. versionchanged:: 4.0
- Also accepts the URL for the logo file.
+ Also accepts a URL.
.. confval:: html_favicon
+ :type: :code-py:`str`
+ :default: :code-py:`''`
+
+ If given, this must be the name of an image file
+ (path relative to the :term:`configuration directory`)
+ that is the favicon_ of the documentation,
+ or a URL that points an image file for the favicon.
+ Browsers use this as the icon for tabs, windows and bookmarks.
+ It should be a 16-by-16 pixel icon in
+ the PNG, SVG, GIF, or ICO file formats.
- If given, this must be the name of an image file (path relative to the
- :term:`configuration directory`) that is the favicon of the docs, or URL that
- points an image file for the favicon. Modern browsers use this as the icon
- for tabs, windows and bookmarks. It should be a Windows-style icon file
- (``.ico``), which is 16x16 or 32x32 pixels large. Default: ``None``.
+ .. _favicon: https://developer.mozilla.org/en-US/
+ docs/Web/HTML/Attributes/rel#icon
+
+ Example:
+
+ .. code-block:: python
+
+ html_favicon = 'static/favicon.png'
.. versionadded:: 0.4
- The image file will be copied to the ``_static`` directory of the output
- HTML, but only if the file does not already exist there.
+ The image file will be copied to the ``_static``,
+ but only if the file does not already exist there.
.. versionchanged:: 4.0
Also accepts the URL for the favicon.
.. confval:: html_css_files
+ :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
+ :default: :code-py:`[]`
- A list of CSS files. The entry must be a *filename* string or a tuple
- containing the *filename* string and the *attributes* dictionary. The
- *filename* must be relative to the :confval:`html_static_path`, or a full URI
- with scheme like ``https://example.org/style.css``. The *attributes* is used
- for attributes of ``<link>`` tag. It defaults to an empty list.
+ A list of CSS files.
+ The entry must be a *filename* string
+ or a tuple containing the *filename* string and the *attributes* dictionary.
+ The *filename* must be relative to the :confval:`html_static_path`,
+ or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
+ The *attributes* dictionary is used for the ``<link>`` tag's attributes.
- Example::
+ Example:
- html_css_files = ['custom.css',
- 'https://example.com/css/custom.css',
- ('print.css', {'media': 'print'})]
+ .. code-block:: python
+
+ html_css_files = [
+ 'custom.css',
+ 'https://example.com/css/custom.css',
+ ('print.css', {'media': 'print'}),
+ ]
- As a special attribute, *priority* can be set as an integer to load the CSS
- file earlier or lazier step. For more information, refer
- :meth:`.Sphinx.add_css_file()`.
+ The special attribute *priority* can be set as an integer
+ to load the CSS file at an earlier or later step.
+ For more information, refer to :meth:`.Sphinx.add_css_file()`.
.. versionadded:: 1.8
.. versionchanged:: 3.5
-
- Support priority attribute
+ Support the *priority* attribute
.. confval:: html_js_files
+ :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
+ :default: :code-py:`[]`
- A list of JavaScript *filename*. The entry must be a *filename* string or a
- tuple containing the *filename* string and the *attributes* dictionary. The
- *filename* must be relative to the :confval:`html_static_path`, or a full
- URI with scheme like ``https://example.org/script.js``. The *attributes* is
- used for attributes of ``<script>`` tag. It defaults to an empty list.
+ A list of JavaScript files.
+ The entry must be a *filename* string
+ or a tuple containing the *filename* string and the *attributes* dictionary.
+ The *filename* must be relative to the :confval:`html_static_path`,
+ or a full URI with scheme like :code-py:`'https://example.org/script.js'`.
+ The *attributes* dictionary is used for the ``<script>`` tag's attributes.
- Example::
+ Example:
- html_js_files = ['script.js',
- 'https://example.com/scripts/custom.js',
- ('custom.js', {'async': 'async'})]
+ .. code-block:: python
- As a special attribute, *priority* can be set as an integer to load the CSS
- file earlier or lazier step. For more information, refer
- :meth:`.Sphinx.add_css_file()`.
+ html_js_files = [
+ 'script.js',
+ 'https://example.com/scripts/custom.js',
+ ('custom.js', {'async': 'async'}),
+ ]
+
+ As a special attribute, *priority* can be set as an integer
+ to load the JavaScript file at an earlier or later step.
+ For more information, refer to :meth:`.Sphinx.add_js_file()`.
.. versionadded:: 1.8
.. versionchanged:: 3.5
-
- Support priority attribute
+ Support the *priority* attribute
.. confval:: html_static_path
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
- A list of paths that contain custom static files (such as style
- sheets or script files). Relative paths are taken as relative to
- the configuration directory. They are copied to the output's
- :file:`_static` directory after the theme's static files, so a file
- named :file:`default.css` will overwrite the theme's
- :file:`default.css`.
+ A list of paths that contain custom static files
+ (such as style sheets or script files).
+ Relative paths are taken as relative to the :term:`configuration directory`.
+ They are copied to the output's :file:`_static` directory
+ after the theme's static files,
+ so a file named :file:`default.css` will overwrite
+ the theme's :file:`default.css`.
- As these files are not meant to be built, they are automatically excluded
- from source files.
+ As these files are not meant to be built,
+ they are automatically excluded from source files.
.. note::
- For security reasons, dotfiles under ``html_static_path`` will
- not be copied. If you would like to copy them intentionally, please
- add each filepath to this setting::
+ For security reasons, dotfiles under :confval:`!html_static_path`
+ will not be copied.
+ If you would like to copy them intentionally,
+ explicitly add each file to this setting:
- html_static_path = ['_static', '_static/.htaccess']
+ .. code-block:: python
- Another way to do that, you can also use
- :confval:`html_extra_path`. It allows to copy dotfiles under
- the directories.
+ html_static_path = ['_static', '_static/.htaccess']
+
+ An alternative approach is to use :confval:`html_extra_path`,
+ which allows copying dotfiles under the directories.
.. versionchanged:: 0.4
The paths in :confval:`html_static_path` can now contain subdirectories.
@@ -1244,244 +1681,298 @@ that use Sphinx's HTMLWriter class.
files.
.. confval:: html_extra_path
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
A list of paths that contain extra files not directly related to
- the documentation, such as :file:`robots.txt` or :file:`.htaccess`.
- Relative paths are taken as relative to the configuration
- directory. They are copied to the output directory. They will
- overwrite any existing file of the same name.
+ the documentation,
+ such as :file:`robots.txt` or :file:`.htaccess`.
+ Relative paths are taken as relative to the :term:`configuration directory`.
+ They are copied to the output directory.
+ They will overwrite any existing file of the same name.
- As these files are not meant to be built, they are automatically excluded
- from source files.
+ As these files are not meant to be built,
+ they are automatically excluded from source files.
.. versionadded:: 1.2
.. versionchanged:: 1.4
- The dotfiles in the extra directory will be copied to the output
- directory. And it refers :confval:`exclude_patterns` on copying extra
+ The dotfiles in the extra directory will be copied
+ to the output directory.
+ And it refers :confval:`exclude_patterns` on copying extra
files and directories, and ignores if path matches to patterns.
.. confval:: html_last_updated_fmt
+ :type: :code-py:`str`
+ :default: :code-py:`'%b %d, %Y'`
- If this is not None, a 'Last updated on:' timestamp is inserted
- at every page bottom, using the given :func:`~time.strftime` format.
- The empty string is equivalent to ``'%b %d, %Y'`` (or a
- locale-dependent equivalent).
-
-.. confval:: html_use_smartypants
-
- If true, quotes and dashes are converted to typographically correct
- entities. Default: ``True``.
-
- .. deprecated:: 1.6
- To disable smart quotes, use rather :confval:`smartquotes`.
+ If set, a 'Last updated on:' timestamp is inserted into the page footer
+ using the given :func:`~time.strftime` format.
+ The empty string is equivalent to :code-py:`'%b %d, %Y'`
+ (or a locale-dependent equivalent).
.. confval:: html_permalinks
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
Add link anchors for each heading and description environment.
- Default: ``True``.
.. versionadded:: 3.5
.. confval:: html_permalinks_icon
+ :type: :code-py:`str`
+ :default: :code-py:`'¶'` (the paragraph sign)
Text for link anchors for each heading and description environment.
- HTML entities and Unicode are allowed. Default: a paragraph sign; ``¶``
+ HTML entities and Unicode are allowed.
.. versionadded:: 3.5
.. confval:: html_sidebars
+ :type: :code-py:`dict[str, Sequence[str]]`
+ :default: :code-py:`{}`
- Custom sidebar templates, must be a dictionary that maps document names to
- template names.
-
- The keys can contain glob-style patterns [1]_, in which case all matching
- documents will get the specified sidebars. (A warning is emitted when a
- more than one glob-style pattern matches for any document.)
-
- The values can be either lists or single strings.
+ A dictionary defining custom sidebar templates,
+ mapping document names to template names.
- * If a value is a list, it specifies the complete list of sidebar templates
- to include. If all or some of the default sidebars are to be included,
- they must be put into this list as well.
+ The keys can contain `glob-style patterns`_,
+ in which case all matching documents will get the specified sidebars.
+ (A warning is emitted when a more than one glob-style pattern
+ matches for any document.)
- The default sidebars (for documents that don't match any pattern) are
- defined by theme itself. Builtin themes are using these templates by
- default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
- 'searchbox.html']``.
+ Each value must be a list of strings which specifies
+ the complete list of sidebar templates to include.
+ If all or some of the default sidebars are to be included,
+ they must be put into this list as well.
- * If a value is a single string, it specifies a custom sidebar to be added
- between the ``'sourcelink.html'`` and ``'searchbox.html'`` entries. This
- is for compatibility with Sphinx versions before 1.0.
+ The default sidebars (for documents that don't match any pattern) are
+ defined by theme itself.
+ The builtin themes use these templates by default:
+ :code-py:`'localtoc.html'`, :code-py:`'relations.html'`,
+ :code-py:`'sourcelink.html'`, and :code-py:`'searchbox.html'`.
- .. deprecated:: 1.7
-
- a single string value for ``html_sidebars`` will be removed in 2.0
-
- Builtin sidebar templates that can be rendered are:
+ The bundled first-party sidebar templates that can be rendered are:
* **localtoc.html** -- a fine-grained table of contents of the current
document
* **globaltoc.html** -- a coarse-grained table of contents for the whole
documentation set, collapsed
* **relations.html** -- two links to the previous and next documents
- * **sourcelink.html** -- a link to the source of the current document, if
- enabled in :confval:`html_show_sourcelink`
+ * **sourcelink.html** -- a link to the source of the current document,
+ if enabled in :confval:`html_show_sourcelink`
* **searchbox.html** -- the "quick search" box
- Example::
+ Example:
+
+ .. code-block:: python
html_sidebars = {
'**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
- 'using/windows': ['windowssidebar.html', 'searchbox.html'],
+ 'using/windows': ['windows-sidebar.html', 'searchbox.html'],
}
- This will render the custom template ``windowssidebar.html`` and the quick
+ This will render the custom template ``windows-sidebar.html`` and the quick
search box within the sidebar of the given document, and render the default
sidebars for all other pages (except that the local TOC is replaced by the
global TOC).
+ Note that this value only has no effect if
+ the chosen theme does not possess a sidebar,
+ like the builtin **scrolls** and **haiku** themes.
+
.. versionadded:: 1.0
The ability to use globbing keys and to specify multiple sidebars.
- Note that this value only has no effect if the chosen theme does not possess
- a sidebar, like the builtin **scrolls** and **haiku** themes.
+ .. deprecated:: 1.7
+ A single string value for :confval:`!html_sidebars` will be removed.
+
+ .. versionchanged:: 2.0
+ :confval:`!html_sidebars` must be a list of strings,
+ and no longer accepts a single string value.
.. confval:: html_additional_pages
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
- Additional templates that should be rendered to HTML pages, must be a
- dictionary that maps document names to template names.
+ Additional templates that should be rendered to HTML pages,
+ must be a dictionary that maps document names to template names.
- Example::
+ Example:
+
+ .. code-block:: python
html_additional_pages = {
- 'download': 'customdownload.html',
+ 'download': 'custom-download.html.jinja',
}
- This will render the template ``customdownload.html`` as the page
- ``download.html``.
+ This will render the template :file:`custom-download.html.jinja`
+ as the page :file:`download.html`.
.. confval:: html_domain_indices
+ :type: :code-py:`bool | Sequence[str]`
+ :default: :code-py:`True`
- If true, generate domain-specific indices in addition to the general index.
- For e.g. the Python domain, this is the global module index. Default is
- ``True``.
+ If True, generate domain-specific indices in addition to the general index.
+ For e.g. the Python domain, this is the global module index.
- This value can be a bool or a list of index names that should be generated.
+ This value can be a Boolean or a list of index names that should be generated.
To find out the index name for a specific index, look at the HTML file name.
For example, the Python module index has the name ``'py-modindex'``.
+ Example:
+
+ .. code-block:: python
+
+ html_domain_indices = {
+ 'py-modindex',
+ }
+
.. versionadded:: 1.0
+ .. versionchanged:: 7.4
+ Permit and prefer a set type.
.. confval:: html_use_index
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, add an index to the HTML documents. Default is ``True``.
+ Controls if an index is added to the HTML documents.
.. versionadded:: 0.4
.. confval:: html_split_index
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If true, the index is generated twice: once as a single page with all the
- entries, and once as one page per starting letter. Default is ``False``.
+ Generates two versions of the index:
+ once as a single page with all the entries,
+ and once as one page per starting letter.
.. versionadded:: 0.4
.. confval:: html_copy_source
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, the reST sources are included in the HTML build as
- :file:`_sources/{name}`. The default is ``True``.
+ If True, the reStructuredText sources are included in the HTML build as
+ :file:`_sources/{docname}`.
.. confval:: html_show_sourcelink
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true (and :confval:`html_copy_source` is true as well), links to the
- reST sources will be added to the sidebar. The default is ``True``.
+ If True (and :confval:`html_copy_source` is true as well),
+ links to the reStructuredText sources will be added to the sidebar.
.. versionadded:: 0.6
.. confval:: html_sourcelink_suffix
+ :type: :code-py:`str`
+ :default: :code-py:`'.txt'`
- Suffix to be appended to source links (see :confval:`html_show_sourcelink`),
- unless they have this suffix already. Default is ``'.txt'``.
+ The suffix to append to source links
+ (see :confval:`html_show_sourcelink`),
+ unless files they have this suffix already.
.. versionadded:: 1.5
.. confval:: html_use_opensearch
+ :type: :code-py:`str`
+ :default: :code-py:`''`
If nonempty, an `OpenSearch <https://github.com/dewitt/opensearch>`_
- description file will be output, and all pages will contain a ``<link>``
- tag referring to it. Since OpenSearch doesn't support relative URLs for
- its search page location, the value of this option must be the base URL
- from which these documents are served (without trailing slash), e.g.
- ``"https://docs.python.org"``. The default is ``''``.
+ description file will be output,
+ and all pages will contain a ``<link>`` tag referring to it.
+ Since OpenSearch doesn't support relative URLs for its search page location,
+ the value of this option must be the base URL
+ from which these documents are served (without trailing slash),
+ e.g. :code-py:`'https://docs.python.org'`.
+
+ .. versionadded:: 0.2
.. confval:: html_file_suffix
+ :type: :code-py:`str`
+ :default: :code-py:`'.html'`
- This is the file name suffix for generated HTML files, if set to a :obj:`str`
- value. If left to the default ``None``, the suffix will be ``".html"``.
+ The file name suffix (file extension) for generated HTML files.
.. versionadded:: 0.4
.. confval:: html_link_suffix
+ :type: :code-py:`str`
+ :default: The value of **html_file_suffix**
- Suffix for generated links to HTML files. The default is whatever
- :confval:`html_file_suffix` is set to; it can be set differently (e.g. to
- support different web server setups).
+ The suffix for generated links to HTML files.
+ Intended to support more esoteric server setups.
.. versionadded:: 0.6
.. confval:: html_show_copyright
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, "(C) Copyright ..." is shown in the HTML footer. Default is
- ``True``.
+ If True, "© Copyright ..." is shown in the HTML footer,
+ with the value or values from :confval:`copyright`.
.. versionadded:: 1.0
.. confval:: html_show_search_summary
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, the text around the keyword is shown as summary of each search result.
- Default is ``True``.
+ Show a summary of the search result, i.e., the text around the keyword.
.. versionadded:: 4.5
.. confval:: html_show_sphinx
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
+
+ Add "Created using Sphinx_" to the HTML footer.
- If true, "Created using Sphinx" is shown in the HTML footer. Default is
- ``True``.
+ .. _Sphinx: https://www.sphinx-doc.org/
.. versionadded:: 0.4
.. confval:: html_output_encoding
+ :type: :code-py:`str`
+ :default: :code-py:`'utf-8'`
- Encoding of HTML output files. Default is ``'utf-8'``. Note that this
- encoding name must both be a valid Python encoding name and a valid HTML
- ``charset`` value.
+ Encoding of HTML output files.
+ This encoding name must both be a valid Python encoding name
+ and a valid HTML ``charset`` value.
.. versionadded:: 1.0
.. confval:: html_compact_lists
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, a list all whose items consist of a single paragraph and/or a
+ If True, a list all whose items consist of a single paragraph and/or a
sub-list all whose items etc... (recursive definition) will not use the
- ``<p>`` element for any of its items. This is standard docutils behavior.
- Default: ``True``.
+ ``<p>`` element for any of its items. This is standard docutils behaviour.
+ Default: :code-py:`True`.
.. versionadded:: 1.0
.. confval:: html_secnumber_suffix
+ :type: :code-py:`str`
+ :default: :code-py:`'. '`
- Suffix for section numbers. Default: ``". "``. Set to ``" "`` to suppress
- the final dot on section numbers.
+ Suffix for section numbers in HTML output.
+ Set to :code-py:`' '` to suppress the final dot on section numbers.
.. versionadded:: 1.0
.. confval:: html_search_language
+ :type: :code-py:`str`
+ :default: The value of **language**
- Language to be used for generating the HTML full-text search index. This
- defaults to the global language selected with :confval:`language`. If there
- is no support for this language, ``"en"`` is used which selects the English
- language.
+ Language to be used for generating the HTML full-text search index.
+ This defaults to the global language selected with :confval:`language`.
+ English (:code-py:`'en'`) is used as a fall-back option
+ if there is no support for this language.
- Support is present for these languages:
+ Support exists for the following languages:
* ``da`` -- Danish
* ``nl`` -- Dutch
@@ -1501,149 +1992,191 @@ that use Sphinx's HTMLWriter class.
* ``tr`` -- Turkish
* ``zh`` -- Chinese
- .. admonition:: Accelerating build speed
+ .. tip:: Accelerating build speed
Each language (except Japanese) provides its own stemming algorithm.
- Sphinx uses a Python implementation by default. You can use a C
- implementation to accelerate building the index file.
+ Sphinx uses a Python implementation by default.
+ If you want to accelerate building the index file,
+ you can use a third-party package (PyStemmer_) by running
+ :command:`pip install PyStemmer`.
- * `PorterStemmer <https://pypi.org/project/PorterStemmer/>`_ (``en``)
- * `PyStemmer <https://pypi.org/project/PyStemmer/>`_ (all languages)
+ .. _PyStemmer: https://pypi.org/project/PyStemmer/
.. versionadded:: 1.1
- With support for ``en`` and ``ja``.
+ Support English (``en``) and Japanese (``ja``).
.. versionchanged:: 1.3
Added additional languages.
.. confval:: html_search_options
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
- A dictionary with options for the search language support, empty by default.
+ A dictionary with options for the search language support.
The meaning of these options depends on the language selected.
-
- The English support has no options.
-
- The Japanese support has these options:
-
- :type:
- _`type` is dotted module path string to specify Splitter implementation
- which should be derived from :class:`!sphinx.search.ja.BaseSplitter`. If
- not specified or ``None`` is specified,
- ``'sphinx.search.ja.DefaultSplitter'`` will be used.
-
- You can choose from these modules:
-
- :'sphinx.search.ja.DefaultSplitter':
- TinySegmenter algorithm. This is default splitter.
- :'sphinx.search.ja.MecabSplitter':
- MeCab binding. To use this splitter, 'mecab' python binding or dynamic
- link library ('libmecab.so' for linux, 'libmecab.dll' for windows) is
- required.
- :'sphinx.search.ja.JanomeSplitter':
- Janome binding. To use this splitter,
- `Janome <https://pypi.org/project/Janome/>`_ is required.
-
- .. deprecated:: 1.6
- ``'mecab'``, ``'janome'`` and ``'default'`` is deprecated.
- To keep compatibility, ``'mecab'``, ``'janome'`` and ``'default'`` are
- also acceptable.
-
- Other option values depend on splitter value which you choose.
-
- Options for ``'mecab'``:
- :dic_enc:
- _`dic_enc option` is the encoding for the MeCab algorithm.
- :dict:
- _`dict option` is the dictionary to use for the MeCab algorithm.
- :lib:
- _`lib option` is the library name for finding the MeCab library via
- ctypes if the Python binding is not installed.
-
- For example::
-
- html_search_options = {
- 'type': 'mecab',
- 'dic_enc': 'utf-8',
- 'dict': '/path/to/mecab.dic',
- 'lib': '/path/to/libmecab.so',
- }
-
- Options for ``'janome'``:
- :user_dic:
- _`user_dic option` is the user dictionary file path for Janome.
- :user_dic_enc:
- _`user_dic_enc option` is the encoding for the user dictionary file
- specified by ``user_dic`` option. Default is 'utf8'.
+ Currently, only Japanese and Chinese support options.
+
+ :Japanese:
+ ``type`` -- the type of the splitter to use.
+ The other options depend on the splitter used.
+
+ :code-py:`'sphinx.search.ja.DefaultSplitter'`
+ The TinySegmenter algorithm, used by default.
+ :code-py:`'sphinx.search.ja.MecabSplitter'`:
+ The MeCab binding
+ To use this splitter, the 'mecab' python binding
+ or dynamic link library
+ ('libmecab.so' for Linux, 'libmecab.dll' for Windows) is required.
+ :code-py:`'sphinx.search.ja.JanomeSplitter'`:
+ The Janome binding.
+ To use this splitter,
+ `Janome <https://pypi.org/project/Janome/>`_ is required.
+
+
+ .. deprecated:: 1.6
+ ``'mecab'``, ``'janome'`` and ``'default'`` is deprecated.
+ To keep compatibility,
+ ``'mecab'``, ``'janome'`` and ``'default'`` are also acceptable.
+
+ Options for :code-py:`'mecab'`:
+ :dic_enc:
+ _`dic_enc option` is the encoding for the MeCab algorithm.
+ :dict:
+ _`dict option` is the dictionary to use for the MeCab algorithm.
+ :lib:
+ _`lib option` is the library name for finding the MeCab library
+ via ``ctypes`` if the Python binding is not installed.
+
+ For example:
+
+ .. code-block:: python
+
+ html_search_options = {
+ 'type': 'mecab',
+ 'dic_enc': 'utf-8',
+ 'dict': '/path/to/mecab .dic',
+ 'lib': '/path/to/libmecab.so',
+ }
+
+ Options for :code-py:`'janome'`:
+ :user_dic:
+ _`user_dic option` is the user dictionary file path for Janome.
+ :user_dic_enc:
+ _`user_dic_enc option` is the encoding for
+ the user dictionary file specified by ``user_dic`` option.
+ Default is 'utf8'.
+
+ :Chinese:
+ ``dict``
+ The ``jieba`` dictionary path for using a custom dictionary.
.. versionadded:: 1.1
.. versionchanged:: 1.4
- html_search_options for Japanese is re-organized and any custom splitter
- can be used by `type`_ settings.
+ Allow any custom splitter in the *type* setting for Japanese.
+
+.. confval:: html_search_scorer
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- The Chinese support has these options:
+ The name of a JavaScript file
+ (relative to the :term:`configuration directory`)
+ that implements a search results scorer.
+ If empty, the default will be used.
- * ``dict`` -- the ``jieba`` dictionary path if want to use
- custom dictionary.
+ The scorer must implement the following interface,
+ and may optionally define the :code-js:`score()` function
+ for more granular control.
-.. confval:: html_search_scorer
+ .. code-block:: javascript
- The name of a JavaScript file (relative to the configuration directory) that
- implements a search results scorer. If empty, the default will be used.
+ const Scorer = {
+ // Implement the following function to further tweak the score for each result
+ score: result => {
+ const [docName, title, anchor, descr, score, filename] = result
- .. XXX describe interface for scorer here
+ // ... calculate a new score ...
+ return score
+ },
+
+ // query matches the full name of an object
+ objNameMatch: 11,
+ // or matches in the last dotted part of the object name
+ objPartialMatch: 6,
+ // Additive scores depending on the priority of the object
+ objPrio: {
+ 0: 15, // used to be importantResults
+ 1: 5, // used to be objectResults
+ 2: -5, // used to be unimportantResults
+ },
+ // Used when the priority is not in the mapping.
+ objPrioDefault: 0,
+
+ // query found in title
+ title: 15,
+ partialTitle: 7,
+
+ // query found in terms
+ term: 5,
+ partialTerm: 2,
+ };
.. versionadded:: 1.2
.. confval:: html_scaled_image_link
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, image itself links to the original image if it doesn't have
- 'target' option or scale related options: 'scale', 'width', 'height'.
- The default is ``True``.
+ Link images that have been resized with a
+ scale option (*scale*, *width*, or *height*)
+ to their original full-resolution image.
+ This will not overwrite any link given by the *target* option
+ on the the :dudir:`image` directive, if present.
- Document authors can disable this feature manually with giving
- ``no-scaled-link`` class to the image:
+ .. tip::
- .. code-block:: rst
+ To disable this feature on a per-image basis,
+ add the ``no-scaled-link`` class to the image directive:
- .. image:: sphinx.png
- :scale: 50%
- :class: no-scaled-link
+ .. code-block:: rst
+
+ .. image:: sphinx.png
+ :scale: 50%
+ :class: no-scaled-link
.. versionadded:: 1.3
.. versionchanged:: 3.0
-
- It is disabled for images having ``no-scaled-link`` class
+ Images with the ``no-scaled-link`` class will not be linked.
.. confval:: html_math_renderer
+ :type: :code-py:`str`
+ :default: :code-py:`'mathjax'`
- The name of math_renderer extension for HTML output. The default is
- ``'mathjax'``.
+ The maths renderer to use for HTML output.
+ The bundled renders are *mathjax* and *imgmath*.
+ You must also load the relevant extension in :confval:`extensions`.
.. versionadded:: 1.8
-.. confval:: html_experimental_html5_writer
-
- Output is processed with HTML5 writer. Default is ``False``.
-
- .. versionadded:: 1.6
-
- .. deprecated:: 2.0
-
-.. confval:: html4_writer
-
- Output is processed with HTML4 writer. Default is ``False``.
Options for Single HTML output
-------------------------------
+These options influence Single HTML output.
+This builder derives from the HTML builder,
+so the HTML options also apply where appropriate.
+
.. confval:: singlehtml_sidebars
+ :type: :code-py:`dict[str, Sequence[str]]`
+ :default: The value of **html_sidebars**
- Custom sidebar templates, must be a dictionary that maps document names to
- template names. And it only allows a key named `'index'`. All other keys
- are ignored. For more information, refer to :confval:`html_sidebars`. By
- default, it is same as :confval:`html_sidebars`.
+ A dictionary defining custom sidebar templates,
+ mapping document names to template names.
+
+ This has the same effect as :confval:`html_sidebars`,
+ but the only permitted key is :code-py:`'index'`,
+ and all other keys are ignored.
.. _htmlhelp-options:
@@ -1651,20 +2184,31 @@ Options for Single HTML output
Options for HTML help output
-----------------------------
+These options influence HTML help output.
+This builder derives from the HTML builder,
+so the HTML options also apply where appropriate.
+
.. confval:: htmlhelp_basename
+ :type: :code-py:`str`
+ :default: :code-py:`'{project}doc'`
- Output file base name for HTML help builder. Default is ``'pydoc'``.
+ Output file base name for HTML help builder.
+ The default is the :confval:`project name <project>`
+ with spaces removed and ``doc`` appended.
.. confval:: htmlhelp_file_suffix
+ :type: :code-py:`str`
+ :default: :code-py:`'.html'`
- This is the file name suffix for generated HTML help files. The
- default is ``".html"``.
+ This is the file name suffix for generated HTML help files.
.. versionadded:: 2.0
.. confval:: htmlhelp_link_suffix
+ :type: :code-py:`str`
+ :default: The value of **htmlhelp_file_suffix**
- Suffix for generated links to HTML files. The default is ``".html"``.
+ Suffix for generated links to HTML files.
.. versionadded:: 2.0
@@ -1676,26 +2220,35 @@ Options for Apple Help output
.. versionadded:: 1.3
-These options influence the Apple Help output. This builder derives from the
-HTML builder, so the HTML options also apply where appropriate.
+These options influence Apple Help output.
+This builder derives from the HTML builder,
+so the HTML options also apply where appropriate.
.. note::
- Apple Help output will only work on Mac OS X 10.6 and higher, as it
- requires the :program:`hiutil` and :program:`codesign` command line tools,
- neither of which are Open Source.
+ Apple Help output will only work on Mac OS X 10.6 and higher,
+ as it requires the :program:`hiutil` and :program:`codesign`
+ command-line tools, neither of which are Open Source.
You can disable the use of these tools using
- :confval:`applehelp_disable_external_tools`, but the result will not be a
- valid help book until the indexer is run over the ``.lproj`` folders within
- the bundle.
+ :confval:`applehelp_disable_external_tools`,
+ but the result will not be a valid help book
+ until the indexer is run over the ``.lproj`` directories within the bundle.
+
+ .. TODO: Is this warning still relevant as of 2024-07?
+ Needs updating by someone with a Mac.
.. confval:: applehelp_bundle_name
+ :type: :code-py:`str`
+ :default: The value of **project**
- The basename for the Apple Help Book. Defaults to the :confval:`project`
- name.
+ The basename for the Apple Help Book.
+ The default is the :confval:`project name <project>`
+ with spaces removed.
.. confval:: applehelp_bundle_id
+ :type: :code-py:`str`
+ :default: :code-py:`None`
The bundle ID for the help book bundle.
@@ -1703,388 +2256,509 @@ HTML builder, so the HTML options also apply where appropriate.
You *must* set this value in order to generate Apple Help.
-.. confval:: applehelp_dev_region
+.. confval:: applehelp_bundle_version
+ :type: :code-py:`str`
+ :default: :code-py:`'1'`
- The development region. Defaults to ``'en-us'``, which is Apple’s
- recommended setting.
+ The bundle version, as a string.
-.. confval:: applehelp_bundle_version
+.. confval:: applehelp_dev_region
+ :type: :code-py:`str`
+ :default: :code-py:`'en-us'`
- The bundle version (as a string). Defaults to ``'1'``.
+ The development region.
+ Defaults to Apple’s recommended setting, :code-py:`'en-us'`.
.. confval:: applehelp_icon
+ :type: :code-py:`str`
+ :default: :code-py:`None`
- The help bundle icon file, or ``None`` for no icon. According to Apple's
- documentation, this should be a 16-by-16 pixel version of the application's
- icon with a transparent background, saved as a PNG file.
+ Path to the help bundle icon file or :code-py:`None` for no icon.
+ According to Apple's documentation,
+ this should be a 16-by-16 pixel version of the application's icon
+ with a transparent background, saved as a PNG file.
.. confval:: applehelp_kb_product
+ :type: :code-py:`str`
+ :default: :samp:`'{project}-{release}'`
- The product tag for use with :confval:`applehelp_kb_url`. Defaults to
- :samp:`'{<project>}-{<release>}'`.
+ The product tag for use with :confval:`applehelp_kb_url`.
.. confval:: applehelp_kb_url
+ :type: :code-py:`str`
+ :default: :code-py:`None`
The URL for your knowledgebase server,
e.g. ``https://example.com/kbsearch.py?p='product'&q='query'&l='lang'``.
- Help Viewer will replace the values ``'product'``, ``'query'`` and
- ``'lang'`` at runtime with the contents of :confval:`applehelp_kb_product`,
- the text entered by the user in the search box and the user's system
- language respectively.
+ At runtime, Help Viewer will replace
+ ``'product'`` with the contents of :confval:`applehelp_kb_product`,
+ ``'query'`` with the text entered by the user in the search box,
+ and ``'lang'`` with the user's system language.
- Defaults to ``None`` for no remote search.
+ Set this to to :code-py:`None` to disable remote search.
.. confval:: applehelp_remote_url
+ :type: :code-py:`str`
+ :default: :code-py:`None`
- The URL for remote content. You can place a copy of your Help Book's
- ``Resources`` folder at this location and Help Viewer will attempt to use
- it to fetch updated content.
+ The URL for remote content.
+ You can place a copy of your Help Book's ``Resources`` directory
+ at this location and Help Viewer will attempt to use it
+ to fetch updated content.
- e.g. if you set it to ``https://example.com/help/Foo/`` and Help Viewer
- wants a copy of ``index.html`` for an English speaking customer, it will
- look at ``https://example.com/help/Foo/en.lproj/index.html``.
+ For example, if you set it to ``https://example.com/help/Foo/``
+ and Help Viewer wants a copy of ``index.html`` for
+ an English speaking customer,
+ it will look at ``https://example.com/help/Foo/en.lproj/index.html``.
- Defaults to ``None`` for no remote content.
+ Set this to to :code-py:`None` for no remote content.
.. confval:: applehelp_index_anchors
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If ``True``, tell the help indexer to index anchors in the generated HTML.
- This can be useful for jumping to a particular topic using the
- ``AHLookupAnchor`` function or the ``openHelpAnchor:inBook:`` method in
- your code. It also allows you to use ``help:anchor`` URLs; see the Apple
- documentation for more information on this topic.
+ Tell the help indexer to index anchors in the generated HTML.
+ This can be useful for jumping to a particular topic
+ using the ``AHLookupAnchor`` function
+ or the ``openHelpAnchor:inBook:`` method in your code.
+ It also allows you to use ``help:anchor`` URLs;
+ see the Apple documentation for more information on this topic.
.. confval:: applehelp_min_term_length
+ :type: :code-py:`str`
+ :default: :code-py:`None`
- Controls the minimum term length for the help indexer. Defaults to
- ``None``, which means the default will be used.
+ Controls the minimum term length for the help indexer.
+ If :code-py:`None`, use the default length.
.. confval:: applehelp_stopwords
+ :type: :code-py:`str`
+ :default: The value of **language**
- Either a language specification (to use the built-in stopwords), or the
- path to a stopwords plist, or ``None`` if you do not want to use stopwords.
+ Either a language specification (to use the built-in stopwords),
+ or the path to a stopwords plist,
+ or :code-py:`None` if you do not want to use stopwords.
The default stopwords plist can be found at
- ``/usr/share/hiutil/Stopwords.plist`` and contains, at time of writing,
- stopwords for the following languages:
-
- ========= ====
- Language Code
- ========= ====
- English en
- German de
- Spanish es
- French fr
- Swedish sv
- Hungarian hu
- Italian it
- ========= ====
-
- Defaults to :confval:`language`, or if that is not set, to ``'en'``.
+ ``/usr/share/hiutil/Stopwords.plist``
+ and contains, at time of writing, stopwords for the following languages:
-.. confval:: applehelp_locale
+ * German (``de``)
+ * English (``en``)
+ * Spanish (``es``)
+ * French (``fr``)
+ * Hungarian (``hu``)
+ * Italian (``it``)
+ * Swedish (``sv``)
- Specifies the locale to generate help for. This is used to determine
- the name of the ``.lproj`` folder inside the Help Book’s ``Resources``, and
- is passed to the help indexer.
+.. confval:: applehelp_locale
+ :type: :code-py:`str`
+ :default: The value of **language**
- Defaults to :confval:`language`, or if that is not set, to ``'en'``.
+ Specifies the locale to generate help for.
+ This is used to determine the name of the ``.lproj`` directory
+ inside the Help Book’s ``Resources``,
+ and is passed to the help indexer.
.. confval:: applehelp_title
+ :type: :code-py:`str`
+ :default: :samp:`'{project} Help'`
- Specifies the help book title. Defaults to :samp:`'{<project>} Help'`.
+ Specifies the help book title.
.. confval:: applehelp_codesign_identity
+ :type: :code-py:`str`
+ :default: The value of **CODE_SIGN_IDENTITY**
- Specifies the identity to use for code signing, or ``None`` if code signing
- is not to be performed.
+ Specifies the identity to use for code signing.
+ Use :code-py:`None` if code signing is not to be performed.
- Defaults to the value of the environment variable ``CODE_SIGN_IDENTITY``,
- which is set by Xcode for script build phases, or ``None`` if that variable
- is not set.
+ Defaults to the value of the :envvar:`!CODE_SIGN_IDENTITY`
+ environment variable, which is set by Xcode for script build phases,
+ or :code-py:`None` if that variable is not set.
.. confval:: applehelp_codesign_flags
+ :type: :code-py:`list[str]`
+ :default: The value of **OTHER_CODE_SIGN_FLAGS**
A *list* of additional arguments to pass to :program:`codesign` when
signing the help book.
- Defaults to a list based on the value of the environment variable
- ``OTHER_CODE_SIGN_FLAGS``, which is set by Xcode for script build phases,
+ Defaults to a list based on the value of the :envvar:`!OTHER_CODE_SIGN_FLAGS`
+ environment variable, which is set by Xcode for script build phases,
or the empty list if that variable is not set.
-.. confval:: applehelp_indexer_path
+.. confval:: applehelp_codesign_path
+ :type: :code-py:`str`
+ :default: :code-py:`'/usr/bin/codesign'`
- The path to the :program:`hiutil` program. Defaults to
- ``'/usr/bin/hiutil'``.
+ The path to the :program:`codesign` program.
-.. confval:: applehelp_codesign_path
+.. confval:: applehelp_indexer_path
+ :type: :code-py:`str`
+ :default: :code-py:`'/usr/bin/hiutil'`
- The path to the :program:`codesign` program. Defaults to
- ``'/usr/bin/codesign'``.
+ The path to the :program:`hiutil` program.
.. confval:: applehelp_disable_external_tools
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If ``True``, the builder will not run the indexer or the code signing tool,
+ Do not run the indexer or the code signing tool,
no matter what other settings are specified.
- This is mainly useful for testing, or where you want to run the Sphinx
- build on a non-Mac OS X platform and then complete the final steps on OS X
- for some reason.
-
- Defaults to ``False``.
+ This is mainly useful for testing,
+ or where you want to run the Sphinx build on a non-macOS platform
+ and then complete the final steps on a Mac for some reason.
.. _epub-options:
-Options for epub output
+Options for EPUB output
-----------------------
-These options influence the epub output. As this builder derives from the HTML
-builder, the HTML options also apply where appropriate. The actual values for
-some of the options is not really important, they just have to be entered into
-the `Dublin Core metadata <https://dublincore.org/>`_.
+These options influence EPUB output.
+This builder derives from the HTML builder,
+so the HTML options also apply where appropriate.
+
+.. note::
+ The actual value for some of these options is not important,
+ but they are required for the `Dublin Core metadata`_.
+
+ .. _Dublin Core metadata: https://dublincore.org/
.. confval:: epub_basename
+ :type: :code-py:`str`
+ :default: The value of **project**
- The basename for the epub file. It defaults to the :confval:`project` name.
+ The basename for the EPUB file.
.. confval:: epub_theme
+ :type: :code-py:`str`
+ :default: :code-py:`'epub'`
- The HTML theme for the epub output. Since the default themes are not
- optimized for small screen space, using the same theme for HTML and epub
- output is usually not wise. This defaults to ``'epub'``, a theme designed
- to save visual space.
+ The HTML theme for the EPUB output. Since the default themes are not
+ optimised for small screen space, using the same theme for HTML and EPUB
+ output is usually not wise.
+ This defaults to :code-py:`'epub'`,
+ a theme designed to save visual space.
.. confval:: epub_theme_options
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary of options that influence the look and feel of the selected
- theme. These are theme-specific. For the options understood by the builtin
- themes, see :ref:`this section <builtin-themes>`.
+ A dictionary of options that influence the
+ look and feel of the selected theme.
+ These are theme-specific.
+ The options understood by the :ref:`builtin themes
+ <builtin-themes>` are described :ref:`here <builtin-themes>`.
.. versionadded:: 1.2
.. confval:: epub_title
+ :type: :code-py:`str`
+ :default: The value of **project**
- The title of the document. It defaults to the :confval:`html_title` option
- but can be set independently for epub creation. It defaults to the
- :confval:`project` option.
+ The title of the document.
.. versionchanged:: 2.0
- It defaults to the ``project`` option.
+ It defaults to the :confval:`!project` option
+ (previously :confval:`!html_title`).
.. confval:: epub_description
+ :type: :code-py:`str`
+ :default: :code-py:`'unknown'`
- The description of the document. The default value is ``'unknown'``.
+ The description of the document.
.. versionadded:: 1.4
.. versionchanged:: 1.5
- Renamed from ``epub3_description``
+ Renamed from :confval:`!epub3_description`
.. confval:: epub_author
+ :type: :code-py:`str`
+ :default: The value of **author**
- The author of the document. This is put in the Dublin Core metadata. It
- defaults to the :confval:`author` option.
+ The author of the document.
+ This is put in the Dublin Core metadata.
.. confval:: epub_contributor
+ :type: :code-py:`str`
+ :default: :code-py:`'unknown'`
- The name of a person, organization, etc. that played a secondary role in
- the creation of the content of an EPUB Publication. The default value is
- ``'unknown'``.
+ The name of a person, organisation, etc. that played a secondary role
+ in the creation of the content of an EPUB Publication.
.. versionadded:: 1.4
.. versionchanged:: 1.5
- Renamed from ``epub3_contributor``
+ Renamed from :confval:`!epub3_contributor`
.. confval:: epub_language
+ :type: :code-py:`str`
+ :default: The value of **language**
- The language of the document. This is put in the Dublin Core metadata. The
- default is the :confval:`language` option or ``'en'`` if unset.
+ The language of the document.
+ This is put in the Dublin Core metadata.
.. confval:: epub_publisher
+ :type: :code-py:`str`
+ :default: The value of **author**
- The publisher of the document. This is put in the Dublin Core metadata.
- You may use any sensible string, e.g. the project homepage. The defaults to
- the :confval:`author` option.
+ The publisher of the document.
+ This is put in the Dublin Core metadata.
+ You may use any sensible string, e.g. the project homepage.
.. confval:: epub_copyright
+ :type: :code-py:`str`
+ :default: The value of **copyright**
- The copyright of the document. It defaults to the :confval:`copyright`
- option but can be set independently for epub creation.
+ The copyright of the document.
.. confval:: epub_identifier
+ :type: :code-py:`str`
+ :default: :code-py:`'unknown'`
- An identifier for the document. This is put in the Dublin Core metadata.
- For published documents this is the ISBN number, but you can also use an
- alternative scheme, e.g. the project homepage. The default value is
- ``'unknown'``.
+ An identifier for the document.
+ This is put in the Dublin Core metadata.
+ For published documents this is the ISBN number,
+ but you can also use an alternative scheme, e.g. the project homepage.
.. confval:: epub_scheme
+ :type: :code-py:`str`
+ :default: :code-py:`'unknown'`
- The publication scheme for the :confval:`epub_identifier`. This is put in
- the Dublin Core metadata. For published books the scheme is ``'ISBN'``. If
- you use the project homepage, ``'URL'`` seems reasonable. The default value
- is ``'unknown'``.
+ The publication scheme for the :confval:`epub_identifier`.
+ This is put in the Dublin Core metadata.
+ For published books the scheme is ``'ISBN'``.
+ If you use the project homepage, ``'URL'`` seems reasonable.
.. confval:: epub_uid
+ :type: :code-py:`str`
+ :default: :code-py:`'unknown'`
+
+ A unique identifier for the document.
+ This is put in the Dublin Core metadata.
+ You may use a `XML's Name format`_ string.
+ You can't use hyphen, period, numbers as a first character.
- A unique identifier for the document. This is put in the Dublin Core
- metadata. You may use a
- `XML's Name format <https://www.w3.org/TR/REC-xml/#NT-NameStartChar>`_
- string. You can't use hyphen, period, numbers as a first character. The
- default value is ``'unknown'``.
+ .. _XML's Name format: https://www.w3.org/TR/REC-xml/#NT-NameStartChar
.. confval:: epub_cover
+ :type: :code-py:`tuple[str, str]`
+ :default: :code-py:`()`
- The cover page information. This is a tuple containing the filenames of
- the cover image and the html template. The rendered html cover page is
- inserted as the first item in the spine in :file:`content.opf`. If the
- template filename is empty, no html cover page is created. No cover at all
- is created if the tuple is empty. Examples::
+ The cover page information.
+ This is a tuple containing the filenames of the cover image
+ and the html template.
+ The rendered html cover page is inserted as the first item
+ in the spine in :file:`content.opf`.
+ If the template filename is empty, no html cover page is created.
+ No cover at all is created if the tuple is empty.
+
+ Examples:
+
+ .. code-block:: python
epub_cover = ('_static/cover.png', 'epub-cover.html')
epub_cover = ('_static/cover.png', '')
epub_cover = ()
- The default value is ``()``.
-
.. versionadded:: 1.1
.. confval:: epub_css_files
+ :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
+ :default: :code-py:`[]`
- A list of CSS files. The entry must be a *filename* string or a tuple
- containing the *filename* string and the *attributes* dictionary. For more
- information, see :confval:`html_css_files`.
+ A list of CSS files.
+ The entry must be a *filename* string
+ or a tuple containing the *filename* string and the *attributes* dictionary.
+ The *filename* must be relative to the :confval:`html_static_path`,
+ or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
+ The *attributes* dictionary is used for the ``<link>`` tag's attributes.
+ For more information, see :confval:`html_css_files`.
.. versionadded:: 1.8
.. confval:: epub_guide
+ :type: :code-py:`Sequence[tuple[str, str, str]]`
+ :default: :code-py:`()`
+
+ Meta data for the guide element of :file:`content.opf`.
+ This is a sequence of tuples containing
+ the *type*, the *uri* and the *title* of the optional guide information.
+ See `the OPF documentation <https://idpf.org/epub>`_ for details.
+ If possible, default entries for the *cover* and *toc* types
+ are automatically inserted.
+ However, the types can be explicitly overwritten
+ if the default entries are not appropriate.
+
+ Example:
- Meta data for the guide element of :file:`content.opf`. This is a
- sequence of tuples containing the *type*, the *uri* and the *title* of
- the optional guide information. See the OPF documentation
- at `<http://idpf.org/epub>`_ for details. If possible, default entries
- for the *cover* and *toc* types are automatically inserted. However,
- the types can be explicitly overwritten if the default entries are not
- appropriate. Example::
+ .. code-block:: python
- epub_guide = (('cover', 'cover.html', 'Cover Page'),)
+ epub_guide = (
+ ('cover', 'cover.html', 'Cover Page'),
+ )
- The default value is ``()``.
+ The default value is :code-py:`()`.
.. confval:: epub_pre_files
+ :type: :code-py:`Sequence[tuple[str, str]]`
+ :default: :code-py:`()`
+
+ Additional files that should be inserted before the text generated by Sphinx.
+ It is a list of tuples containing the file name and the title.
+ If the title is empty, no entry is added to :file:`toc.ncx`.
+
+ Example:
- Additional files that should be inserted before the text generated by
- Sphinx. It is a list of tuples containing the file name and the title.
- If the title is empty, no entry is added to :file:`toc.ncx`. Example::
+ .. code-block:: python
epub_pre_files = [
('index.html', 'Welcome'),
]
- The default value is ``[]``.
-
.. confval:: epub_post_files
+ :type: :code-py:`Sequence[tuple[str, str]]`
+ :default: :code-py:`()`
Additional files that should be inserted after the text generated by Sphinx.
- It is a list of tuples containing the file name and the title. This option
- can be used to add an appendix. If the title is empty, no entry is added
- to :file:`toc.ncx`. The default value is ``[]``.
+ It is a list of tuples containing the file name and the title.
+ This option can be used to add an appendix.
+ If the title is empty, no entry is added to :file:`toc.ncx`.
+
+ Example:
+
+ .. code-block:: python
+
+ epub_post_files = [
+ ('appendix.xhtml', 'Appendix'),
+ ]
.. confval:: epub_exclude_files
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`[]`
- A list of files that are generated/copied in the build directory but should
- not be included in the epub file. The default value is ``[]``.
+ A sequence of files that are generated/copied in the build directory
+ but should not be included in the EPUB file.
.. confval:: epub_tocdepth
+ :type: :code-py:`int`
+ :default: :code-py:`3`
+
+ The depth of the table of contents in the file :file:`toc.ncx`.
+ It should be an integer greater than zero.
- The depth of the table of contents in the file :file:`toc.ncx`. It should
- be an integer greater than zero. The default value is 3. Note: A deeply
- nested table of contents may be difficult to navigate.
+ .. tip::
+ A deeply nested table of contents may be difficult to navigate.
.. confval:: epub_tocdup
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- This flag determines if a toc entry is inserted again at the beginning of
- its nested toc listing. This allows easier navigation to the top of
- a chapter, but can be confusing because it mixes entries of different
- depth in one list. The default value is ``True``.
+ This flag determines if a ToC entry is inserted again
+ at the beginning of its nested ToC listing.
+ This allows easier navigation to the top of a chapter,
+ but can be confusing because it mixes entries of different depth in one list.
.. confval:: epub_tocscope
+ :type: :code-py:`'default' | 'includehidden'`
+ :default: :code-py:`'default'`
- This setting control the scope of the epub table of contents. The setting
- can have the following values:
+ This setting control the scope of the EPUB table of contents.
+ The setting can have the following values:
- * ``'default'`` -- include all toc entries that are not hidden (default)
- * ``'includehidden'`` -- include all toc entries
+ :code-py:`'default'`
+ Include all ToC entries that are not hidden
+ :code-py:`'includehidden'`
+ Include all ToC entries
.. versionadded:: 1.2
.. confval:: epub_fix_images
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- This flag determines if sphinx should try to fix image formats that are not
- supported by some epub readers. At the moment palette images with a small
- color table are upgraded. You need Pillow, the Python Image Library,
- installed to use this option. The default value is ``False`` because the
+ Try and fix image formats that are not supported by some EPUB readers.
+ At the moment palette images with a small colour table are upgraded.
+ This is disabled by default because the
automatic conversion may lose information.
+ You need the Python Image Library (Pillow_) installed to use this option.
+
+ .. _Pillow: https://pypi.org/project/Pillow/
.. versionadded:: 1.2
.. confval:: epub_max_image_width
+ :type: :code-py:`int`
+ :default: :code-py:`0`
+
+ This option specifies the maximum width of images.
+ If it is set to a valuevgreater than zero,
+ images with a width larger than the given value are scaled accordingly.
+ If it is zero, no scaling is performed.
+ You need the Python Image Library (Pillow_) installed to use this option.
- This option specifies the maximum width of images. If it is set to a value
- greater than zero, images with a width larger than the given value are
- scaled accordingly. If it is zero, no scaling is performed. The default
- value is ``0``. You need the Python Image Library (Pillow) installed to use
- this option.
+ .. _Pillow: https://pypi.org/project/Pillow/
.. versionadded:: 1.2
.. confval:: epub_show_urls
+ :type: :code-py:`'footnote' | 'no' | 'inline'`
+ :default: :code-py:`'footnote'`
- Control whether to display URL addresses. This is very useful for
- readers that have no other means to display the linked URL. The
- settings can have the following values:
+ Control how to display URL addresses.
+ This is very useful for readers that have no other means
+ to display the linked URL.
+ The setting can have the following values:
- * ``'inline'`` -- display URLs inline in parentheses (default)
- * ``'footnote'`` -- display URLs in footnotes
- * ``'no'`` -- do not display URLs
+ :code-py:`'inline'`
+ Display URLs inline in parentheses.
+ :code-py:`'footnote'`
+ Display URLs in footnotes.
+ :code-py:`'no'`
+ Do not display URLs.
- The display of inline URLs can be customized by adding CSS rules for the
- class ``link-target``.
+ The display of inline URLs can be customised by adding CSS rules
+ for the class ``link-target``.
.. versionadded:: 1.2
.. confval:: epub_use_index
+ :type: :code-py:`bool`
+ :default: The value of **html_use_index**
- If true, add an index to the epub document. It defaults to the
- :confval:`html_use_index` option but can be set independently for epub
- creation.
+ Add an index to the EPUB document.
.. versionadded:: 1.2
.. confval:: epub_writing_mode
+ :type: :code-py:`'horizontal' | 'vertical'`
+ :default: :code-py:`'horizontal'`
- It specifies writing direction. It can accept ``'horizontal'`` (default) and
- ``'vertical'``
+ It specifies writing direction.
+ It can accept :code-py:`'horizontal'` and :code-py:`'vertical'`
.. list-table::
+ :align: left
:header-rows: 1
:stub-columns: 1
- - * ``epub_writing_mode``
- * ``'horizontal'``
- * ``'vertical'``
- - * writing-mode [#]_
- * ``horizontal-tb``
- * ``vertical-rl``
- - * page progression
- * left to right
- * right to left
- - * iBook's Scroll Theme support
- * scroll-axis is vertical.
- * scroll-axis is horizontal.
+ * - ``epub_writing_mode``
+ - ``'horizontal'``
+ - ``'vertical'``
+ * - writing-mode_
+ - ``horizontal-tb``
+ - ``vertical-rl``
+ * - page progression
+ - left to right
+ - right to left
+ * - iBook's Scroll Theme support
+ - scroll-axis is vertical.
+ - scroll-axis is horizontal.
- .. [#] https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode
+ .. _writing-mode: https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode
.. _latex-options:
@@ -2095,241 +2769,295 @@ Options for LaTeX output
These options influence LaTeX output.
.. confval:: latex_engine
+ :type: :code-py:`'pdflatex' | 'xelatex' | 'lualatex' | 'platex' | 'uplatex'`
+ :default: :code-py:`'pdflatex'`
+
+ The LaTeX engine to build the documentation.
+ The setting can have the following values:
+
+ * :code-py:`'pdflatex'` -- PDFLaTeX (default)
+ * :code-py:`'xelatex'` -- XeLaTeX
+ * :code-py:`'lualatex'` -- LuaLaTeX
+ * :code-py:`'platex'` -- pLaTeX
+ * :code-py:`'uplatex'` -- upLaTeX
+ (default if :confval:`language` is :code-py:`'ja'`)
+
+ .. caution::
+ ``'pdflatex'``\ 's support for Unicode characters is limited.
+ If your project uses Unicode characters,
+ setting the engine to ``'xelatex'`` or ``'lualatex'``
+ and making sure to use an OpenType font with wide-enough glyph coverage
+ is often easier than trying to make ``'pdflatex'`` work
+ with the extra Unicode characters.
+ Since Sphinx 2.0, the default typeface is GNU FreeFont,
+ which has good coverage of Latin, Cyrillic, and Greek glyphs.
- The LaTeX engine to build the docs. The setting can have the following
- values:
-
- * ``'pdflatex'`` -- PDFLaTeX (default)
- * ``'xelatex'`` -- XeLaTeX
- * ``'lualatex'`` -- LuaLaTeX
- * ``'platex'`` -- pLaTeX
- * ``'uplatex'`` -- upLaTeX (default if :confval:`language` is ``'ja'``)
+ .. note::
- ``'pdflatex'``\ 's support for Unicode characters is limited.
+ Sphinx 2.0 adds support to ``'pdflatex'`` in Latin language document of
+ occasional Cyrillic or Greek letters or words.
+ This is not automatic, see the discussion
+ of the ``'fontenc'`` key in :confval:`latex_elements` .
.. note::
- 2.0 adds to ``'pdflatex'`` support in Latin language document of
- occasional Cyrillic or Greek letters or words. This is not automatic,
- see the discussion of the :confval:`latex_elements` ``'fontenc'`` key.
-
- If your project uses Unicode characters, setting the engine to
- ``'xelatex'`` or ``'lualatex'`` and making sure to use an OpenType font
- with wide-enough glyph coverage is often easier than trying to make
- ``'pdflatex'`` work with the extra Unicode characters. Since Sphinx 2.0
- the default is the GNU FreeFont which covers well Latin, Cyrillic and
- Greek.
+ Contrarily to :ref:`MathJaX math rendering in HTML output <math-support>`,
+ LaTeX requires some extra configuration to support Unicode literals in
+ :rst:dir:`math`:
+ the only comprehensive solution (as far as we know) is to
+ use ``'xelatex'`` or ``'lualatex'`` *and* to add
+ ``r'\usepackage{unicode-math}'``
+ (e.g. via the :confval:`latex_elements` ``'preamble'`` key).
+ You may prefer ``r'\usepackage[math-style=literal]{unicode-math}'``
+ to keep a Unicode literal such as ``α`` (U+03B1) as-is in output,
+ rather than being rendered as :math:`\alpha`.
.. versionchanged:: 2.1.0
-
- Use ``xelatex`` (and LaTeX package ``xeCJK``) by default for Chinese
- documents.
+ Use ``xelatex`` (and LaTeX package ``xeCJK``)
+ by default for Chinese documents.
.. versionchanged:: 2.2.1
-
Use ``xelatex`` by default for Greek documents.
.. versionchanged:: 2.3
-
Add ``uplatex`` support.
.. versionchanged:: 4.0
-
- ``uplatex`` becomes the default setting of Japanese documents.
-
- Contrarily to :ref:`MathJaX math rendering in HTML output <math-support>`,
- LaTeX requires some extra configuration to support Unicode literals in
- :rst:dir:`math`: the only comprehensive solution (as far as we know) is to
- use ``'xelatex'`` or ``'lualatex'`` *and* to add
- ``r'\usepackage{unicode-math}'`` (e.g. via the :confval:`latex_elements`
- ``'preamble'`` key). You may prefer
- ``r'\usepackage[math-style=literal]{unicode-math}'`` to keep a Unicode
- literal such as ``α`` (U+03B1) for example as is in output, rather than
- being rendered as :math:`\alpha`.
+ Use ``uplatex`` by default for Japanese documents.
.. confval:: latex_documents
+ :type: :code-py:`Sequence[tuple[str, str, str, str, str, bool]]`
+ :default: The default LaTeX documents
- This value determines how to group the document tree into LaTeX source files.
+ This value determines how to group the document tree
+ into LaTeX source files.
It must be a list of tuples ``(startdocname, targetname, title, author,
- theme, toctree_only)``, where the items are:
+ theme, toctree_only)``,
+ where the items are:
*startdocname*
- String that specifies the :term:`document name` of the LaTeX file's master
- document. All documents referenced by the *startdoc* document in TOC trees
- will be included in the LaTeX file. (If you want to use the default root
- document for your LaTeX build, provide your :confval:`root_doc` here.)
+ String that specifies the :term:`document name` of
+ the LaTeX file's master document.
+ All documents referenced by the *startdoc* document in
+ ToC trees will be included in the LaTeX file.
+ (If you want to use the default master document for your LaTeX build,
+ provide your :confval:`master_doc` here.)
*targetname*
- File name of the LaTeX file in the output directory.
+ File name of the LaTeX file in the output directory.
*title*
- LaTeX document title. Can be empty to use the title of the *startdoc*
- document. This is inserted as LaTeX markup, so special characters like a
- backslash or ampersand must be represented by the proper LaTeX commands if
- they are to be inserted literally.
+ LaTeX document title.
+ Can be empty to use the title of the *startdoc* document.
+ This is inserted as LaTeX markup,
+ so special characters like a backslash or ampersand
+ must be represented by the proper LaTeX commands
+ if they are to be inserted literally.
*author*
- Author for the LaTeX document. The same LaTeX markup caveat as for *title*
- applies. Use ``\\and`` to separate multiple authors, as in:
- ``'John \\and Sarah'`` (backslashes must be Python-escaped to reach LaTeX).
+ Author for the LaTeX document.
+ The same LaTeX markup caveat as for *title* applies.
+ Use ``\\and`` to separate multiple authors, as in: ``'John \\and Sarah'``
+ (backslashes must be Python-escaped to reach LaTeX).
*theme*
- LaTeX theme. See :confval:`latex_theme`.
+ LaTeX theme.
+ See :confval:`latex_theme`.
*toctree_only*
- Must be ``True`` or ``False``. If true, the *startdoc* document itself is
- not included in the output, only the documents referenced by it via TOC
- trees. With this option, you can put extra stuff in the master document
- that shows up in the HTML, but not the LaTeX output.
+ Must be :code-py:`True` or :code-py:`False`.
+ If True, the *startdoc* document itself is not included in the output,
+ only the documents referenced by it via ToC trees.
+ With this option, you can put extra stuff in the master document
+ that shows up in the HTML, but not the LaTeX output.
+
+ .. versionadded:: 0.3
+ The 6th item ``toctree_only``.
+ Tuples with 5 items are still accepted.
.. versionadded:: 1.2
In the past including your own document class required you to prepend the
- document class name with the string "sphinx". This is not necessary
- anymore.
-
- .. versionadded:: 0.3
- The 6th item ``toctree_only``. Tuples with 5 items are still accepted.
+ document class name with the string "sphinx".
+ This is not necessary anymore.
.. confval:: latex_logo
+ :type: :code-py:`str`
+ :default: :code-py:`''`
- If given, this must be the name of an image file (relative to the
- configuration directory) that is the logo of the docs. It is placed at the
- top of the title page. Default: ``None``.
+ If given, this must be the name of an image file
+ (path relative to the :term:`configuration directory`)
+ that is the logo of the documentation.
+ It is placed at the top of the title page.
.. confval:: latex_toplevel_sectioning
+ :type: :code-py:`'part' | 'chapter' | 'section'`
+ :default: :code-py:`None`
- This value determines the topmost sectioning unit. It should be chosen from
- ``'part'``, ``'chapter'`` or ``'section'``. The default is ``None``;
- the topmost
- sectioning unit is switched by documentclass: ``section`` is used if
- documentclass will be ``howto``, otherwise ``chapter`` will be used.
+ This value determines the topmost sectioning unit.
+ By default, the topmost sectioning unit is switched by documentclass:
+ ``section`` is used if documentclass will be ``howto``,
+ otherwise ``chapter`` is used be used.
- Note that if LaTeX uses ``\part`` command, then the numbering of sectioning
- units one level deep gets off-sync with HTML numbering, because LaTeX
- numbers continuously ``\chapter`` (or ``\section`` for ``howto``.)
+ Note that if LaTeX uses :code-tex:`\\part` command,
+ then the numbering of sectioning units one level deep gets off-sync
+ with HTML numbering,
+ because LaTeX numbers :code-tex:`\\chapter` continuously
+ (or :code-tex:`\\section` for ``howto``).
.. versionadded:: 1.4
.. confval:: latex_appendices
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
A list of document names to append as an appendix to all manuals.
+ This is ignored if :confval:`latex_theme` is set to :code-py:`'howto'`.
.. confval:: latex_domain_indices
+ :type: :code-py:`bool | Sequence[str]`
+ :default: :code-py:`True`
+
+ If True, generate domain-specific indices in addition to the general index.
+ For e.g. the Python domain, this is the global module index.
+
+ This value can be a Boolean or a list of index names that should be generated.
+ To find out the index name for a specific index, look at the HTML file name.
+ For example, the Python module index has the name ``'py-modindex'``.
- If true, generate domain-specific indices in addition to the general index.
- For e.g. the Python domain, this is the global module index. Default is
- ``True``.
+ Example:
- This value can be a bool or a list of index names that should be generated,
- like for :confval:`html_domain_indices`.
+ .. code-block:: python
+
+ latex_domain_indices = {
+ 'py-modindex',
+ }
.. versionadded:: 1.0
+ .. versionchanged:: 7.4
+ Permit and prefer a set type.
.. confval:: latex_show_pagerefs
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If true, add page references after internal references. This is very useful
- for printed copies of the manual. Default is ``False``.
+ Add page references after internal references.
+ This is very useful for printed copies of the manual.
.. versionadded:: 1.0
.. confval:: latex_show_urls
+ :type: :code-py:`'no' | 'footnote' | 'inline'`
+ :default: :code-py:`'no'`
- Control whether to display URL addresses. This is very useful for printed
- copies of the manual. The setting can have the following values:
+ Control how to display URL addresses.
+ This is very useful for printed copies of the manual.
+ The setting can have the following values:
- * ``'no'`` -- do not display URLs (default)
- * ``'footnote'`` -- display URLs in footnotes
- * ``'inline'`` -- display URLs inline in parentheses
+ :code-py:`'no'`
+ Do not display URLs
+ :code-py:`'footnote'`
+ Display URLs in footnotes
+ :code-py:`'inline'`
+ Display URLs inline in parentheses
.. versionadded:: 1.0
.. versionchanged:: 1.1
- This value is now a string; previously it was a boolean value, and a true
- value selected the ``'inline'`` display. For backwards compatibility,
- ``True`` is still accepted.
+ This value is now a string; previously it was a boolean value,
+ and a true value selected the :code-py:`'inline'` display.
+ For backwards compatibility, :code-py:`True` is still accepted.
.. confval:: latex_use_latex_multicolumn
-
- The default is ``False``: it means that Sphinx's own macros are used for
- merged cells from grid tables. They allow general contents (literal blocks,
- lists, blockquotes, ...) but may have problems if the
- :rst:dir:`tabularcolumns` directive was used to inject LaTeX mark-up of the
- type ``>{..}``, ``<{..}``, ``@{..}`` as column specification.
-
- Setting to ``True`` means to use LaTeX's standard ``\multicolumn``; this is
- incompatible with literal blocks in the horizontally merged cell, and also
- with multiple paragraphs in such cell if the table is rendered using
- ``tabulary``.
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
+
+ Use standard LaTeX's :code-tex:`\\multicolumn` for merged cells in tables.
+
+ :code-py:`False`
+ Sphinx's own macros are used for merged cells from grid tables.
+ They allow general contents (literal blocks, lists, blockquotes, ...)
+ but may have problems if the :rst:dir:`tabularcolumns` directive
+ was used to inject LaTeX mark-up of the type
+ ``>{..}``, ``<{..}``, ``@{..}`` as column specification.
+ :code-py:`True`
+ Use LaTeX's standard :code-tex:`\\multicolumn`;
+ this is incompatible with literal blocks in horizontally merged cells,
+ and also with multiple paragraphs in such cells
+ if the table is rendered using ``tabulary``.
.. versionadded:: 1.6
.. confval:: latex_table_style
-
- A list of styling classes (strings). Currently supported:
-
- - ``'booktabs'``: no vertical lines, and only 2 or 3 horizontal lines (the
- latter if there is a header), using the booktabs_ package.
-
- - ``'borderless'``: no lines whatsoever.
-
- - ``'colorrows'``: the table rows are rendered with alternating background
- colours. The interface to customize them is via :ref:`dedicated keys
- <tablecolors>` of :ref:`latexsphinxsetup`.
-
- .. important::
-
- With the ``'colorrows'`` style, the ``\rowcolors`` LaTeX command
- becomes a no-op (this command has limitations and has never correctly
- supported all types of tables Sphinx produces in LaTeX). Please
- update your project to use instead
- the :ref:`latex table color configuration <tablecolors>` keys.
-
- Default: ``['booktabs', 'colorrows']``
-
- .. versionadded:: 5.3.0
-
- .. versionchanged:: 6.0.0
-
- Modify default from ``[]`` to ``['booktabs', 'colorrows']``.
-
- Each table can override the global style via ``:class:`` option, or
- ``.. rst-class::`` for no-directive tables (cf. :ref:`table-directives`).
- Currently recognized classes are ``booktabs``, ``borderless``,
- ``standard``, ``colorrows``, ``nocolorrows``. The latter two can be
- combined with any of the first three. The ``standard`` class produces
- tables with both horizontal and vertical lines (as has been the default so
- far with Sphinx).
-
- A single-row multi-column merged cell will obey the row colour, if it is
- set. See also ``TableMergeColor{Header,Odd,Even}`` in the
- :ref:`latexsphinxsetup` section.
+ :type: :code-py:`list[str]`
+ :default: :code-py:`['booktabs', 'colorrows']`
+
+ A list of styling classes (strings).
+ Currently supported:
+
+ :code-py:`'booktabs'`
+ No vertical lines, and only 2 or 3 horizontal lines
+ (the latter if there is a header),
+ using the booktabs_ package.
+
+ :code-py:`'borderless'`
+ No lines whatsoever.
+
+ :code-py:`'colorrows'`
+ The table rows are rendered with alternating background colours.
+ The interface to customise them is via
+ :ref:`dedicated keys <tablecolors>` of :ref:`latexsphinxsetup`.
+
+ .. important::
+
+ With the :code-py:`'colorrows'` style,
+ the :code-tex:`\\rowcolors` LaTeX command becomes a no-op
+ (this command has limitations and has never correctly
+ supported all types of tables Sphinx produces in LaTeX).
+ Please update your project to use the
+ :ref:`latex table color configuration <tablecolors>` keys instead.
+
+ Each table can override the global style via ``:class:`` option,
+ or ``.. rst-class::`` for no-directive tables (cf. :ref:`table-directives`).
+ Currently recognised classes are ``booktabs``, ``borderless``,
+ ``standard``, ``colorrows``, ``nocolorrows``.
+ The latter two can be combined with any of the first three.
+ The ``standard`` class produces tables with
+ both horizontal and vertical lines
+ (as has been the default so far with Sphinx).
+
+ A single-row multi-column merged cell will obey the row colour,
+ if it is set.
+ See also ``TableMergeColor{Header,Odd,Even}``
+ in the :ref:`latexsphinxsetup` section.
.. note::
- - It is hard-coded in LaTeX that a single cell will obey the row colour
- even if there is a column colour set via ``\columncolor`` from a
- column specification (see :rst:dir:`tabularcolumns`). Sphinx provides
- ``\sphinxnorowcolor`` which can be used like this:
+ * It is hard-coded in LaTeX that a single cell will obey the row colour
+ even if there is a column colour set via :code-tex:`\\columncolor`
+ from a column specification (see :rst:dir:`tabularcolumns`).
+ Sphinx provides :code-tex:`\\sphinxnorowcolor` which can be used
+ in a table column specification like this:
.. code-block:: latex
>{\columncolor{blue}\sphinxnorowcolor}
- in a table column specification.
-
- - Sphinx also provides ``\sphinxcolorblend`` which however requires the
- xcolor_ package. Here is an example:
+ * Sphinx also provides :code-tex:`\\sphinxcolorblend`,
+ which however requires the xcolor_ package.
+ Here is an example:
.. code-block:: latex
>{\sphinxcolorblend{!95!red}}
- It means that in this column, the row colours will be slightly tinted
- by red; refer to xcolor_ documentation for more on the syntax of its
- ``\blendcolors`` command (a ``\blendcolors`` in place of
- ``\sphinxcolorblend`` would modify colours of the cell *contents*, not
- of the cell *background colour panel*...). You can find an example of
- usage in the :ref:`dev-deprecated-apis` section of this document in
- PDF format.
+ It means that in this column,
+ the row colours will be slightly tinted by red;
+ refer to xcolor_ documentation for more on the syntax of its
+ :code-tex:`\\blendcolors` command
+ (a :code-tex:`\\blendcolors` in place of :code-tex:`\\sphinxcolorblend`
+ would modify colours of the cell *contents*,
+ not of the cell *background colour panel*...).
+ You can find an example of usage in the :ref:`dev-deprecated-apis`
+ section of this document in PDF format.
.. hint::
@@ -2337,19 +3065,21 @@ These options influence LaTeX output.
cells of a given column use ``>{\noindent\color{<color>}}``,
possibly in addition to the above.
- - Multi-row merged cells, whether single column or multi-column
+ * Multi-row merged cells, whether single column or multi-column
currently ignore any set column, row, or cell colour.
- - It is possible for a simple cell to set a custom colour via the
- :dudir:`raw` directive and the ``\cellcolor`` LaTeX command used
- anywhere in the cell contents. This currently is without effect
- in a merged cell, whatever its kind.
+ * It is possible for a simple cell to set a custom colour via the
+ :dudir:`raw` directive and
+ the :code-tex:`\\cellcolor` LaTeX command used
+ anywhere in the cell contents.
+ This currently is without effect in a merged cell, whatever its kind.
.. hint::
- In a document not using ``'booktabs'`` globally, it is possible to style
- an individual table via the ``booktabs`` class, but it will be necessary
- to add ``r'\usepackage{booktabs}'`` to the LaTeX preamble.
+ In a document not using ``'booktabs'`` globally,
+ it is possible to style an individual table via the ``booktabs`` class,
+ but it will be necessary to add ``r'\usepackage{booktabs}'``
+ to the LaTeX preamble.
On the other hand one can use ``colorrows`` class for individual tables
with no extra package (as Sphinx since 5.3.0 always loads colortbl_).
@@ -2358,113 +3088,140 @@ These options influence LaTeX output.
.. _colortbl: https://ctan.org/pkg/colortbl
.. _xcolor: https://ctan.org/pkg/xcolor
+ .. versionadded:: 5.3.0
+
+ .. versionchanged:: 6.0.0
+
+ Modify default from :code-py:`[]` to :code-py:`['booktabs', 'colorrows']`.
+
.. confval:: latex_use_xindy
+ :type: :code-py:`bool`
+ :default: :code-py:`True if latex_engine in {'xelatex', 'lualatex'} else False`
- If ``True``, the PDF build from the LaTeX files created by Sphinx
- will use :program:`xindy` (doc__) rather than :program:`makeindex`
- for preparing the index of general terms (from :rst:dir:`index`
- usage). This means that words with UTF-8 characters will get
+ Use Xindy_ to prepare the index of general terms.
+ By default, the LaTeX builder uses :program:`makeindex`
+ for preparing the index of general terms .
+ This means that words with UTF-8 characters will be
ordered correctly for the :confval:`language`.
- __ http://xindy.sourceforge.net/
+ .. _Xindy: https://xindy.sourceforge.net/
- - This option is ignored if :confval:`latex_engine` is ``'platex'``
- (Japanese documents; :program:`mendex` replaces :program:`makeindex`
- then).
+ * This option is ignored if :confval:`latex_engine` is :code-py:`'platex'`
+ (Japanese documents;
+ :program:`mendex` replaces :program:`makeindex` then).
- - The default is ``True`` for ``'xelatex'`` or ``'lualatex'`` as
- :program:`makeindex`, if any indexed term starts with a non-ascii
- character, creates ``.ind`` files containing invalid bytes for
- UTF-8 encoding. With ``'lualatex'`` this then breaks the PDF
- build.
+ * The default is :code-py:`True`
+ for :code-py:`'xelatex'` or :code-py:`'lualatex'` as
+ :program:`makeindex` creates ``.ind`` files containing invalid bytes
+ for the UTF-8 encoding if any indexed term starts with
+ a non-ASCII character.
+ With :code-py:`'lualatex'` this then breaks the PDF build.
- - The default is ``False`` for ``'pdflatex'`` but ``True`` is
- recommended for non-English documents as soon as some indexed
- terms use non-ascii characters from the language script.
+ * The default is :code-py:`False` for :code-py:`'pdflatex'`,
+ but :code-py:`True` is recommended for non-English documents as soon
+ as some indexed terms use non-ASCII characters from the language script.
- Sphinx adds to :program:`xindy` base distribution some dedicated support
- for using ``'pdflatex'`` engine with Cyrillic scripts. And whether with
- ``'pdflatex'`` or Unicode engines, Cyrillic documents handle correctly the
- indexing of Latin names, even with diacritics.
+ Sphinx adds some dedicated support to the :program:`xindy` base distribution
+ for using :code-py:`'pdflatex'` engine with Cyrillic scripts.
+ With both :code-py:`'pdflatex'` and Unicode engines,
+ Cyrillic documents handle the indexing of Latin names correctly,
+ even with diacritics.
.. versionadded:: 1.8
.. confval:: latex_elements
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
.. versionadded:: 0.5
- Its :ref:`documentation <latex_elements_confval>` has moved to :doc:`/latex`.
+ :ref:`See the full documentation for latex_elements <latex_elements_confval>`.
.. confval:: latex_docclass
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
- A dictionary mapping ``'howto'`` and ``'manual'`` to names of real document
- classes that will be used as the base for the two Sphinx classes. Default
- is to use ``'article'`` for ``'howto'`` and ``'report'`` for ``'manual'``.
+ A dictionary mapping :code-py:`'howto'` and :code-py:`'manual'`
+ to names of real document classes that will be used as the base
+ for the two Sphinx classes.
+ Default is to use :code-py:`'article'` for :code-py:`'howto'`
+ and :code-py:`'report'` for :code-py:`'manual'`.
.. versionadded:: 1.0
.. versionchanged:: 1.5
-
- In Japanese docs (:confval:`language` is ``'ja'``), by default
- ``'jreport'`` is used for ``'howto'`` and ``'jsbook'`` for ``'manual'``.
+ In Japanese documentation (:confval:`language` is :code-py:`'ja'`),
+ by default :code-py:`'jreport'` is used for :code-py:`'howto'`
+ and :code-py:`'jsbook'` for :code-py:`'manual'`.
.. confval:: latex_additional_files
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- A list of file names, relative to the configuration directory, to copy to
- the build directory when building LaTeX output. This is useful to copy
- files that Sphinx doesn't copy automatically, e.g. if they are referenced in
- custom LaTeX added in ``latex_elements``. Image files that are referenced
- in source files (e.g. via ``.. image::``) are copied automatically.
+ A list of file names, relative to the :term:`configuration directory`,
+ to copy to the build directory when building LaTeX output.
+ This is useful to copy files that Sphinx doesn't copy automatically,
+ e.g. if they are referenced in custom LaTeX added in ``latex_elements``.
+ Image files that are referenced in source files (e.g. via ``.. image::``)
+ are copied automatically.
You have to make sure yourself that the filenames don't collide with those
of any automatically copied files.
.. attention::
-
- Filenames with extension ``.tex`` will automatically be handed over to
- the PDF build process triggered by :option:`sphinx-build -M`
- ``latexpdf`` or by :program:`make latexpdf`. If the file was added only
- to be ``\input{}`` from a modified preamble, you must add a further
- suffix such as ``.txt`` to the filename and adjust accordingly the
- ``\input{}`` command added to the LaTeX document preamble.
+ Filenames with the ``.tex`` extension will be automatically
+ handed over to the PDF build process triggered by
+ :option:`sphinx-build -M latexpdf <sphinx-build -M>`
+ or by :program:`make latexpdf`.
+ If the file was added only to be :code-tex:`\\input{}`
+ from a modified preamble,
+ you must add a further suffix such as ``.txt`` to the filename
+ and adjust the :code-tex:`\\input{}` macro accordingly.
.. versionadded:: 0.6
.. versionchanged:: 1.2
- This overrides the files which is provided from Sphinx such as
- ``sphinx.sty``.
+ This overrides the files provided from Sphinx such as ``sphinx.sty``.
.. confval:: latex_theme
+ :type: :code-py:`str`
+ :default: :code-py:`'manual'`
- The "theme" that the LaTeX output should use. It is a collection of settings
- for LaTeX output (ex. document class, top level sectioning unit and so on).
+ The "theme" that the LaTeX output should use.
+ It is a collection of settings for LaTeX output
+ (e.g. document class, top level sectioning unit and so on).
- As a built-in LaTeX themes, ``manual`` and ``howto`` are bundled.
+ The bundled first-party LaTeX themes are *manual* and *howto*:
``manual``
- A LaTeX theme for writing a manual. It imports the ``report`` document
- class (Japanese documents use ``jsbook``).
+ A LaTeX theme for writing a manual.
+ It imports the ``report`` document class
+ (Japanese documents use ``jsbook``).
``howto``
- A LaTeX theme for writing an article. It imports the ``article`` document
- class (Japanese documents use ``jreport`` rather). :confval:`latex_appendices`
- is available only for this theme.
-
- It defaults to ``'manual'``.
+ A LaTeX theme for writing an article.
+ It imports the ``article`` document class
+ (Japanese documents use ``jreport``).
+ :confval:`latex_appendices` is only available for this theme.
.. versionadded:: 3.0
.. confval:: latex_theme_options
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary of options that influence the look and feel of the selected
- theme.
+ A dictionary of options that influence the
+ look and feel of the selected theme.
+ These are theme-specific.
.. versionadded:: 3.1
.. confval:: latex_theme_path
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
- A list of paths that contain custom LaTeX themes as subdirectories. Relative
- paths are taken as relative to the configuration directory.
+ A list of paths that contain custom LaTeX themes as subdirectories.
+ Relative paths are taken as relative to the :term:`configuration directory`.
.. versionadded:: 3.0
@@ -2476,42 +3233,47 @@ Options for text output
These options influence text output.
-.. confval:: text_newlines
-
- Determines which end-of-line character(s) are used in text output.
-
- * ``'unix'``: use Unix-style line endings (``\n``)
- * ``'windows'``: use Windows-style line endings (``\r\n``)
- * ``'native'``: use the line ending style of the platform the documentation
- is built on
+.. confval:: text_add_secnumbers
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- Default: ``'unix'``.
+ Include section numbers in text output.
- .. versionadded:: 1.1
+ .. versionadded:: 1.7
-.. confval:: text_sectionchars
+.. confval:: text_newlines
+ :type: :code-py:`'unix' | 'windows' | 'native'`
+ :default: :code-py:`'unix'`
- A string of 7 characters that should be used for underlining sections.
- The first character is used for first-level headings, the second for
- second-level headings and so on.
+ Determines which end-of-line character(s) are used in text output.
- The default is ``'*=-~"+`'``.
+ :code-py:`'unix'`
+ Use Unix-style line endings (``\n``).
+ :code-py:`'windows'`
+ Use Windows-style line endings (``\r\n``).
+ :code-py:`'native'`
+ Use the line ending style of the platform the documentation is built on.
.. versionadded:: 1.1
-.. confval:: text_add_secnumbers
+.. confval:: text_secnumber_suffix
+ :type: :code-py:`str`
+ :default: :code-py:`'. '`
- A boolean that decides whether section numbers are included in text output.
- Default is ``True``.
+ Suffix for section numbers in text output.
+ Set to :code-py:`' '` to suppress the final dot on section numbers.
.. versionadded:: 1.7
-.. confval:: text_secnumber_suffix
+.. confval:: text_sectionchars
+ :type: :code-py:`str`
+ :default: :code-py:`'*=-~"+\`'`
- Suffix for section numbers in text output. Default: ``". "``. Set to
- ``" "`` to suppress the final dot on section numbers.
+ A string of 7 characters that should be used for underlining sections.
+ The first character is used for first-level headings,
+ the second for second-level headings and so on.
- .. versionadded:: 1.7
+ .. versionadded:: 1.1
.. _man-options:
@@ -2522,57 +3284,68 @@ Options for manual page output
These options influence manual page output.
.. confval:: man_pages
+ :type: :code-py:`Sequence[tuple[str, str, str, str, str]]`
+ :default: The default manual pages
- This value determines how to group the document tree into manual pages. It
- must be a list of tuples ``(startdocname, name, description, authors,
- section)``, where the items are:
+ This value determines how to group the document tree
+ into manual pages.
+ It must be a list of tuples
+ ``(startdocname, name, description, authors, section)``,
+ where the items are:
*startdocname*
- String that specifies the :term:`document name` of the manual page's master
- document. All documents referenced by the *startdoc* document in TOC trees
- will be included in the manual file. (If you want to use the default
- root document for your manual pages build, use your :confval:`root_doc`
- here.)
+ String that specifies the :term:`document name` of
+ the manual page's master document.
+ All documents referenced by the *startdoc* document in
+ ToC trees will be included in the manual page.
+ (If you want to use the default master document for your manual pages build,
+ provide your :confval:`master_doc` here.)
*name*
- Name of the manual page. This should be a short string without spaces or
- special characters. It is used to determine the file name as well as the
+ Name of the manual page.
+ This should be a short string without spaces or special characters.
+ It is used to determine the file name as well as the
name of the manual page (in the NAME section).
*description*
- Description of the manual page. This is used in the NAME section.
- Can be an empty string if you do not want to automatically generate
- the NAME section.
+ Description of the manual page.
+ This is used in the NAME section.
+ Can be an empty string if you do not want to
+ automatically generate the NAME section.
*authors*
- A list of strings with authors, or a single string. Can be an empty
- string or list if you do not want to automatically generate an AUTHORS
- section in the manual page.
+ A list of strings with authors, or a single string.
+ Can be an empty string or list if you do not want to
+ automatically generate an AUTHORS section in the manual page.
*section*
- The manual page section. Used for the output file name as well as in the
- manual page header.
+ The manual page section.
+ Used for the output file name as well as in the manual page header.
.. versionadded:: 1.0
.. confval:: man_show_urls
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If true, add URL addresses after links. Default is ``False``.
+ Add URL addresses after links.
.. versionadded:: 1.1
.. confval:: man_make_section_directory
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, make a section directory on build man page. Default is True.
+ Make a section directory on build man page.
.. versionadded:: 3.3
- .. versionchanged:: 4.0
- The default is changed to ``False`` from ``True``.
+ .. versionchanged:: 4.0
+ The default is now :code-py:`False` (previously :code-py:`True`).
.. versionchanged:: 4.0.2
+ Revert the change in the default.
- The default is changed to ``True`` from ``False`` again.
.. _texinfo-options:
@@ -2582,266 +3355,275 @@ Options for Texinfo output
These options influence Texinfo output.
.. confval:: texinfo_documents
+ :type: :code-py:`Sequence[tuple[str, str, str, str, str, str, str, bool]]`
+ :default: The default Texinfo documents
- This value determines how to group the document tree into Texinfo source
- files. It must be a list of tuples ``(startdocname, targetname, title,
- author, dir_entry, description, category, toctree_only)``, where the items
- are:
+ This value determines how to group the document tree
+ into Texinfo source files.
+ It must be a list of tuples ``(startdocname, targetname, title, author,
+ dir_entry, description, category, toctree_only)``,
+ where the items are:
*startdocname*
- String that specifies the :term:`document name` of the the Texinfo file's
- master document. All documents referenced by the *startdoc* document in
- TOC trees will be included in the Texinfo file. (If you want to use the
- default master document for your Texinfo build, provide your
- :confval:`root_doc` here.)
+ String that specifies the :term:`document name` of
+ the Texinfo file's master document.
+ All documents referenced by the *startdoc* document in
+ ToC trees will be included in the Texinfo file.
+ (If you want to use the default master document for your Texinfo build,
+ provide your :confval:`master_doc` here.)
*targetname*
- File name (no extension) of the Texinfo file in the output directory.
+ File name (no extension) of the Texinfo file in the output directory.
*title*
- Texinfo document title. Can be empty to use the title of the *startdoc*
- document. Inserted as Texinfo markup, so special characters like ``@`` and
- ``{}`` will need to be escaped to be inserted literally.
+ Texinfo document title.
+ Can be empty to use the title of the *startdoc*
+ document. Inserted as Texinfo markup,
+ so special characters like ``@`` and ``{}`` will need to
+ be escaped to be inserted literally.
*author*
- Author for the Texinfo document. Inserted as Texinfo markup. Use ``@*``
- to separate multiple authors, as in: ``'John@*Sarah'``.
+ Author for the Texinfo document.
+ Inserted as Texinfo markup.
+ Use ``@*`` to separate multiple authors, as in: ``'John@*Sarah'``.
*dir_entry*
- The name that will appear in the top-level ``DIR`` menu file.
+ The name that will appear in the top-level ``DIR`` menu file.
*description*
- Descriptive text to appear in the top-level ``DIR`` menu file.
+ Descriptive text to appear in the top-level ``DIR`` menu file.
*category*
- Specifies the section which this entry will appear in the top-level
- ``DIR`` menu file.
+ Specifies the section which this entry will appear in the top-level
+ ``DIR`` menu file.
*toctree_only*
- Must be ``True`` or ``False``. If true, the *startdoc* document itself is
- not included in the output, only the documents referenced by it via TOC
- trees. With this option, you can put extra stuff in the master document
- that shows up in the HTML, but not the Texinfo output.
+ Must be :code-py:`True` or :code-py:`False`.
+ If True, the *startdoc* document itself is not included in the output,
+ only the documents referenced by it via ToC trees.
+ With this option, you can put extra stuff in the master document
+ that shows up in the HTML, but not the Texinfo output.
.. versionadded:: 1.1
.. confval:: texinfo_appendices
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`[]`
A list of document names to append as an appendix to all manuals.
.. versionadded:: 1.1
-.. confval:: texinfo_domain_indices
-
- If true, generate domain-specific indices in addition to the general index.
- For e.g. the Python domain, this is the global module index. Default is
- ``True``.
+.. confval:: texinfo_cross_references
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- This value can be a bool or a list of index names that should be generated,
- like for :confval:`html_domain_indices`.
+ Generate inline references in a document.
+ Disabling inline references can make an info file more readable
+ with a stand-alone reader (``info``).
- .. versionadded:: 1.1
+ .. versionadded:: 4.4
-.. confval:: texinfo_show_urls
+.. confval:: texinfo_domain_indices
+ :type: :code-py:`bool | Sequence[str]`
+ :default: :code-py:`True`
- Control how to display URL addresses.
+ If True, generate domain-specific indices in addition to the general index.
+ For e.g. the Python domain, this is the global module index.
- * ``'footnote'`` -- display URLs in footnotes (default)
- * ``'no'`` -- do not display URLs
- * ``'inline'`` -- display URLs inline in parentheses
+ This value can be a Boolean or a list of index names that should be generated.
+ To find out the index name for a specific index, look at the HTML file name.
+ For example, the Python module index has the name ``'py-modindex'``.
- .. versionadded:: 1.1
+ Example:
-.. confval:: texinfo_no_detailmenu
+ .. code-block:: python
- If true, do not generate a ``@detailmenu`` in the "Top" node's menu
- containing entries for each sub-node in the document. Default is ``False``.
+ texinfo_domain_indices = {
+ 'py-modindex',
+ }
- .. versionadded:: 1.2
+ .. versionadded:: 1.1
+ .. versionchanged:: 7.4
+ Permit and prefer a set type.
.. confval:: texinfo_elements
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary that contains Texinfo snippets that override those Sphinx
- usually puts into the generated ``.texi`` files.
+ A dictionary that contains Texinfo snippets that override those that
+ Sphinx usually puts into the generated ``.texi`` files.
* Keys that you may want to override include:
``'paragraphindent'``
- Number of spaces to indent the first line of each paragraph, default
- ``2``. Specify ``0`` for no indentation.
+ Number of spaces to indent the first line of each paragraph,
+ default ``2``.
+ Specify ``0`` for no indentation.
``'exampleindent'``
Number of spaces to indent the lines for examples or literal blocks,
- default ``4``. Specify ``0`` for no indentation.
+ default ``4``.
+ Specify ``0`` for no indentation.
``'preamble'``
Texinfo markup inserted near the beginning of the file.
``'copying'``
- Texinfo markup inserted within the ``@copying`` block and displayed
- after the title. The default value consists of a simple title page
- identifying the project.
-
- * Keys that are set by other options and therefore should not be overridden
- are:
-
- ``'author'``
- ``'body'``
- ``'date'``
- ``'direntry'``
- ``'filename'``
- ``'project'``
- ``'release'``
- ``'title'``
+ Texinfo markup inserted within the ``@copying`` block
+ and displayed after the title.
+ The default value consists of a simple title page identifying the project.
+
+ * Keys that are set by other options
+ and therefore should not be overridden are
+ ``'author'``, ``'body'``, ``'date'``, ``'direntry'``
+ ``'filename'``, ``'project'``, ``'release'``, and ``'title'``.
.. versionadded:: 1.1
-.. confval:: texinfo_cross_references
+.. confval:: texinfo_no_detailmenu
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
- If false, do not generate inline references in a document. That makes
- an info file more readable with stand-alone reader (``info``).
- Default is ``True``.
+ Do not generate a ``@detailmenu`` in the "Top" node's menu
+ containing entries for each sub-node in the document.
+
+ .. versionadded:: 1.2
+
+.. confval:: texinfo_show_urls
+ :type: :code-py:`'footnote' | 'no' | 'inline'`
+ :default: :code-py:`'footnote'`
+
+ Control how to display URL addresses.
+ The setting can have the following values:
+
+ :code-py:`'footnote'`
+ Display URLs in footnotes.
+ :code-py:`'no'`
+ Do not display URLs.
+ :code-py:`'inline'`
+ Display URLs inline in parentheses.
+
+ .. versionadded:: 1.1
- .. versionadded:: 4.4
.. _qthelp-options:
Options for QtHelp output
--------------------------
-These options influence qthelp output. As this builder derives from the HTML
-builder, the HTML options also apply where appropriate.
+These options influence qthelp output.
+This builder derives from the HTML builder,
+so the HTML options also apply where appropriate.
.. confval:: qthelp_basename
+ :type: :code-py:`str`
+ :default: The value of **project**
- The basename for the qthelp file. It defaults to the :confval:`project`
- name.
+ The basename for the qthelp file.
.. confval:: qthelp_namespace
+ :type: :code-py:`str`
+ :default: :code-py:`'org.sphinx.{project_name}.{project_version}'`
- The namespace for the qthelp file. It defaults to
- ``org.sphinx.<project_name>.<project_version>``.
+ The namespace for the qthelp file.
.. confval:: qthelp_theme
+ :type: :code-py:`str`
+ :default: :code-py:`'nonav'`
The HTML theme for the qthelp output.
- This defaults to ``'nonav'``.
.. confval:: qthelp_theme_options
+ :type: :code-py:`dict[str, Any]`
+ :default: :code-py:`{}`
- A dictionary of options that influence the look and feel of the selected
- theme. These are theme-specific. For the options understood by the builtin
- themes, see :ref:`this section <builtin-themes>`.
-
-
-Options for the linkcheck builder
----------------------------------
-
-.. confval:: linkcheck_ignore
-
- A list of regular expressions that match URIs that should not be checked
- when doing a ``linkcheck`` build. Example::
+ A dictionary of options that influence the
+ look and feel of the selected theme.
+ These are theme-specific.
+ The options understood by the :ref:`builtin themes
+ <builtin-themes>` are described :ref:`here <builtin-themes>`.
- linkcheck_ignore = [r'http://localhost:\d+/']
- .. versionadded:: 1.1
+Options for XML output
+----------------------
-.. confval:: linkcheck_allowed_redirects
-
- A dictionary that maps a pattern of the source URI to a pattern of the canonical
- URI. The linkcheck builder treats the redirected link as "working" when:
+.. confval:: xml_pretty
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- - the link in the document matches the source URI pattern, and
- - the redirect location matches the canonical URI pattern.
+ Pretty-print the XML.
- Example:
+ .. versionadded:: 1.2
- .. code-block:: python
- linkcheck_allowed_redirects = {
- # All HTTP redirections from the source URI to the canonical URI will be treated as "working".
- r'https://sphinx-doc\.org/.*': r'https://sphinx-doc\.org/en/master/.*'
- }
+Options for the linkcheck builder
+---------------------------------
- If set, linkcheck builder will emit a warning when disallowed redirection
- found. It's useful to detect unexpected redirects under :option:`the
- warn-is-error mode <sphinx-build -W>`.
+Filtering
+~~~~~~~~~
- .. versionadded:: 4.1
+These options control which links the *linkcheck* builder checks,
+and which failures and redirects it ignores.
-.. confval:: linkcheck_request_headers
+.. confval:: linkcheck_allowed_redirects
+ :type: :code-py:`dict[str, str]`
+ :default: :code-py:`{}`
- A dictionary that maps baseurls to HTTP request headers.
+ A dictionary that maps a pattern of the source URI
+ to a pattern of the canonical URI.
+ The *linkcheck* builder treats the redirected link as "working" when:
- The key is a URL base string like ``"https://www.sphinx-doc.org/"``. To specify
- headers for other hosts, ``"*"`` can be used. It matches all hosts only when
- the URL does not match other settings.
+ * the link in the document matches the source URI pattern, and
+ * the redirect location matches the canonical URI pattern.
- The value is a dictionary that maps header name to its value.
+ The *linkcheck* builder will emit a warning when
+ it finds redirected links that don't meet the rules above.
+ It can be useful to detect unexpected redirects when using
+ :option:`the fail-on-warnings mode <sphinx-build --fail-on-warning>`.
Example:
.. code-block:: python
- linkcheck_request_headers = {
- "https://www.sphinx-doc.org/": {
- "Accept": "text/html",
- "Accept-Encoding": "utf-8",
- },
- "*": {
- "Accept": "text/html,application/xhtml+xml",
- }
+ linkcheck_allowed_redirects = {
+ # All HTTP redirections from the source URI to
+ # the canonical URI will be treated as "working".
+ r'https://sphinx-doc\.org/.*': r'https://sphinx-doc\.org/en/master/.*'
}
- .. versionadded:: 3.1
-
-.. confval:: linkcheck_retries
-
- The number of times the linkcheck builder will attempt to check a URL before
- declaring it broken. Defaults to 1 attempt.
-
- .. versionadded:: 1.4
-
-.. confval:: linkcheck_timeout
-
- A timeout value, in seconds, for the linkcheck builder. The default is to
- use Python's global socket timeout.
-
- .. versionadded:: 1.1
-
-.. confval:: linkcheck_workers
-
- The number of worker threads to use when checking links. Default is 5
- threads.
-
- .. versionadded:: 1.1
+ .. versionadded:: 4.1
.. confval:: linkcheck_anchors
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- If true, check the validity of ``#anchor``\ s in links. Since this requires
- downloading the whole document, it's considerably slower when enabled.
- Default is ``True``.
+ Check the validity of ``#anchor``\ s in links.
+ Since this requires downloading the whole document,
+ it is considerably slower when enabled.
.. versionadded:: 1.2
.. confval:: linkcheck_anchors_ignore
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`["^!"]`
- A list of regular expressions that match anchors Sphinx should skip when
- checking the validity of anchors in links. This allows skipping anchors that
- a website's JavaScript adds to control dynamic pages or when triggering an
- internal REST request. Default is ``["^!"]``.
+ A list of regular expressions that match anchors that the *linkcheck* builder
+ should skip when checking the validity of anchors in links.
+ For example, this allows skipping anchors added by a website's JavaScript.
.. tip::
-
Use :confval:`linkcheck_anchors_ignore_for_url` to check a URL,
but skip verifying that the anchors exist.
.. note::
+ If you want to ignore anchors of a specific page or
+ of pages that match a specific pattern
+ (but still check occurrences of the same page(s) that don't have anchors),
+ use :confval:`linkcheck_ignore` instead,
+ for example as follows:
- If you want to ignore anchors of a specific page or of pages that match a
- specific pattern (but still check occurrences of the same page(s) that
- don't have anchors), use :confval:`linkcheck_ignore` instead, for example
- as follows::
+ .. code-block:: python
linkcheck_ignore = [
'https://www.sphinx-doc.org/en/1.7/intro.html#',
@@ -2850,33 +3632,78 @@ Options for the linkcheck builder
.. versionadded:: 1.5
.. confval:: linkcheck_anchors_ignore_for_url
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
A list or tuple of regular expressions matching URLs
- for which Sphinx should not check the validity of anchors.
+ for which the *linkcheck* builder should not check the validity of anchors.
This allows skipping anchor checks on a per-page basis
while still checking the validity of the page itself.
- Default is an empty tuple ``()``.
.. versionadded:: 7.1
+.. confval:: linkcheck_exclude_documents
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
+
+ A list of regular expressions that match documents in which
+ the *linkcheck* builder should not check the validity of links.
+ This can be used for permitting link decay
+ in legacy or historical sections of the documentation.
+
+ Example:
+
+ .. code-block:: python
+
+ # ignore all links in documents located in a subdirectory named 'legacy'
+ linkcheck_exclude_documents = [r'.*/legacy/.*']
+
+ .. versionadded:: 4.4
+
+.. confval:: linkcheck_ignore
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
+
+ A list of regular expressions that match URIs that should not be checked
+ when doing a ``linkcheck`` build.
+
+ Example:
+
+ .. code-block:: python
+
+ linkcheck_ignore = [r'https://localhost:\d+/']
+
+ .. versionadded:: 1.1
+
+HTTP Requests
+~~~~~~~~~~~~~
+
+These options control how the *linkcheck* builder makes HTTP requests,
+including how it handles redirects and authentication,
+and the number of workers to use.
+
.. confval:: linkcheck_auth
+ :type: :code-py:`Sequence[tuple[str, Any]]`
+ :default: :code-py:`[]`
Pass authentication information when doing a ``linkcheck`` build.
- A list of ``(regex_pattern, auth_info)`` tuples where the items are:
+ A list of :code-py:`(regex_pattern, auth_info)` tuples where the items are:
*regex_pattern*
A regular expression that matches a URI.
*auth_info*
- Authentication information to use for that URI. The value can be anything
- that is understood by the ``requests`` library (see :ref:`requests
- Authentication <requests:authentication>` for details).
+ Authentication information to use for that URI.
+ The value can be anything that is understood by the ``requests`` library
+ (see :ref:`requests authentication <requests:authentication>` for details).
+
+ The *linkcheck* builder will use the first matching ``auth_info`` value
+ it can find in the :confval:`!linkcheck_auth` list,
+ so values earlier in the list have higher priority.
- The ``linkcheck`` builder will use the first matching ``auth_info`` value
- it can find in the :confval:`linkcheck_auth` list, so values earlier in the
- list have higher priority.
+ Example:
- Example::
+ .. code-block:: python
linkcheck_auth = [
('https://foo\.yourcompany\.com/.+', ('johndoe', 'secret')),
@@ -2885,53 +3712,123 @@ Options for the linkcheck builder
.. versionadded:: 2.3
-.. confval:: linkcheck_rate_limit_timeout
+.. confval:: linkcheck_allow_unauthorized
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- The ``linkcheck`` builder may issue a large number of requests to the same
- site over a short period of time. This setting controls the builder behavior
- when servers indicate that requests are rate-limited.
+ When a webserver responds with an HTTP 401 (unauthorised) response,
+ the current default behaviour of the *linkcheck* builder is
+ to treat the link as "working".
+ To change that behaviour, set this option to :code-py:`False`.
+
+ .. attention::
+ The default value for this option will be changed in Sphinx 8.0;
+ from that version onwards,
+ HTTP 401 responses to checked hyperlinks will be treated
+ as "broken" by default.
- If a server indicates when to retry (using the `Retry-After`_ header),
- ``linkcheck`` always follows the server indication.
+ .. xref RemovedInSphinx80Warning
+ .. versionadded:: 7.3
+
+.. confval:: linkcheck_rate_limit_timeout
+ :type: :code-py:`int`
+ :default: :code-py:`300`
+
+ The *linkcheck* builder may issue a large number of requests to the same
+ site over a short period of time.
+ This setting controls the builder behaviour
+ when servers indicate that requests are rate-limited,
+ by setting the maximum duration (in seconds) that the builder will
+ wait for between each attempt before recording a failure.
+
+ The *linkcheck* builder always respects a server's direction
+ of when to retry (using the `Retry-After`_ header).
Otherwise, ``linkcheck`` waits for a minute before to retry and keeps
doubling the wait time between attempts until it succeeds or exceeds the
- ``linkcheck_rate_limit_timeout``. By default, the timeout is 5 minutes.
+ :confval:`!linkcheck_rate_limit_timeout` (in seconds).
+ Custom timeouts should be given as a number of seconds.
.. _Retry-After: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3
.. versionadded:: 3.4
-.. confval:: linkcheck_exclude_documents
+.. confval:: linkcheck_report_timeouts_as_broken
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
- A list of regular expressions that match documents in which Sphinx should
- not check the validity of links. This can be used for permitting link decay
- in legacy or historical sections of the documentation.
+ When an HTTP response is not received from a webserver before the configured
+ :confval:`linkcheck_timeout` expires,
+ the current default behaviour of the *linkcheck* builder is
+ to treat the link as 'broken'.
+ To report timeouts using a distinct report code of ``timeout``,
+ set :confval:`linkcheck_report_timeouts_as_broken` to :code-py:`False`.
- Example::
+ .. attention::
+ From Sphinx 8.0 onwards, timeouts that occur while checking hyperlinks
+ will be reported using the new 'timeout' status code.
- # ignore all links in documents located in a subfolder named 'legacy'
- linkcheck_exclude_documents = [r'.*/legacy/.*']
+ .. xref RemovedInSphinx80Warning
- .. versionadded:: 4.4
+ .. versionadded:: 7.3
+.. confval:: linkcheck_request_headers
+ :type: :code-py:`dict[str, dict[str, str]]`
+ :default: :code-py:`{}`
-Options for the XML builder
----------------------------
+ A dictionary that maps URL (without paths) to HTTP request headers.
-.. confval:: xml_pretty
+ The key is a URL base string like :code-py:`'https://www.sphinx-doc.org/'`.
+ To specify headers for other hosts, :code-py:`"*"` can be used.
+ It matches all hosts only when the URL does not match other settings.
- If true, pretty-print the XML. Default is ``True``.
+ The value is a dictionary that maps header name to its value.
- .. versionadded:: 1.2
+ Example:
+ .. code-block:: python
+
+ linkcheck_request_headers = {
+ "https://www.sphinx-doc.org/": {
+ "Accept": "text/html",
+ "Accept-Encoding": "utf-8",
+ },
+ "*": {
+ "Accept": "text/html,application/xhtml+xml",
+ }
+ }
+
+ .. versionadded:: 3.1
+
+.. confval:: linkcheck_retries
+ :type: :code-py:`int`
+ :default: :code-py:`1`
+
+ The number of times the *linkcheck* builder
+ will attempt to check a URL before declaring it broken.
+
+ .. versionadded:: 1.4
+
+.. confval:: linkcheck_timeout
+ :type: :code-py:`int`
+ :default: :code-py:`30`
+
+ The duration, in seconds, that the *linkcheck* builder
+ will wait for a response after each hyperlink request.
+
+ .. versionadded:: 1.1
+
+.. confval:: linkcheck_workers
+ :type: :code-py:`int`
+ :default: :code-py:`5`
+
+ The number of worker threads to use when checking links.
+
+ .. versionadded:: 1.1
-.. rubric:: Footnotes
-.. [1] A note on available globbing syntax: you can use the standard shell
- constructs ``*``, ``?``, ``[...]`` and ``[!...]`` with the feature that
- these all don't match slashes. A double star ``**`` can be used to
- match any sequence of characters *including* slashes.
+Domain options
+==============
.. _c-config:
@@ -2939,124 +3836,255 @@ Options for the XML builder
Options for the C domain
------------------------
-.. confval:: c_id_attributes
+.. confval:: c_extra_keywords
+ :type: :code-py:`Set[str] | Sequence[str]`
+ :default: :code-py:`['alignas', 'alignof', 'bool',
+ 'complex', 'imaginary', 'noreturn',
+ 'static_assert', 'thread_local']`
- A list of strings that the parser additionally should accept as attributes.
- This can for example be used when attributes have been ``#define`` d for
- portability.
+ A list of identifiers to be recognised as keywords by the C parser.
- .. versionadded:: 3.0
+ .. versionadded:: 4.0.3
+ .. versionchanged:: 7.4
+ :confval:`!c_extra_keywords` can now be a set.
-.. confval:: c_paren_attributes
+.. confval:: c_id_attributes
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- A list of strings that the parser additionally should accept as attributes
- with one argument. That is, if ``my_align_as`` is in the list, then
- ``my_align_as(X)`` is parsed as an attribute for all strings ``X`` that have
- balanced braces (``()``, ``[]``, and ``{}``). This can for example be used
- when attributes have been ``#define`` d for portability.
+ A sequence of strings that the parser should additionally accept
+ as attributes.
+ For example, this can be used when :code-c:`#define`
+ has been used for attributes, for portability.
- .. versionadded:: 3.0
+ Example:
-.. confval:: c_extra_keywords
+ .. code-block:: python
- A list of identifiers to be recognized as keywords by the C parser.
- It defaults to ``['alignas', 'alignof', 'bool', 'complex', 'imaginary',
- 'noreturn', 'static_assert', 'thread_local']``.
+ c_id_attributes = [
+ 'my_id_attribute',
+ ]
- .. versionadded:: 4.0.3
+ .. versionadded:: 3.0
+ .. versionchanged:: 7.4
+ :confval:`!c_id_attributes` can now be a tuple.
.. confval:: c_maximum_signature_line_length
+ :type: :code-py:`int | None`
+ :default: :code-py:`None`
- If a signature's length in characters exceeds the number set, each
- parameter will be displayed on an individual logical line. This is a
- domain-specific setting, overriding :confval:`maximum_signature_line_length`.
+ If a signature's length in characters exceeds the number set,
+ each parameter within the signature will be displayed on
+ an individual logical line.
+
+ When :code-py:`None`, there is no maximum length and the entire
+ signature will be displayed on a single logical line.
+
+ This is a domain-specific setting,
+ overriding :confval:`maximum_signature_line_length`.
.. versionadded:: 7.1
+.. confval:: c_paren_attributes
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
+
+ A sequence of strings that the parser should additionally accept
+ as attributes with one argument.
+ That is, if ``my_align_as`` is in the list,
+ then :code-c:`my_align_as(X)` is parsed as an attribute
+ for all strings ``X`` that have balanced braces
+ (:code-c:`()`, :code-c:`[]`, and :code-c:`{}`).
+ For example, this can be used when :code-c:`#define`
+ has been used for attributes, for portability.
+
+ Example:
+
+ .. code-block:: python
+
+ c_paren_attributes = [
+ 'my_align_as',
+ ]
+
+ .. versionadded:: 3.0
+ .. versionchanged:: 7.4
+ :confval:`!c_paren_attributes` can now be a tuple.
+
+
.. _cpp-config:
Options for the C++ domain
--------------------------
-.. confval:: cpp_index_common_prefix
+.. confval:: cpp_id_attributes
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- A list of prefixes that will be ignored when sorting C++ objects in the
- global index. For example ``['awesome_lib::']``.
+ A sequence of strings that the parser should additionally accept
+ as attributes.
+ For example, this can be used when :code-cpp:`#define`
+ has been used for attributes, for portability.
+
+ Example:
+
+ .. code-block:: python
+
+ cpp_id_attributes = [
+ 'my_id_attribute',
+ ]
.. versionadded:: 1.5
+ .. versionchanged:: 7.4
+ :confval:`!cpp_id_attributes` can now be a tuple.
-.. confval:: cpp_id_attributes
+.. confval:: cpp_index_common_prefix
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
- A list of strings that the parser additionally should accept as attributes.
- This can for example be used when attributes have been ``#define`` d for
- portability.
+ A list of prefixes that will be ignored
+ when sorting C++ objects in the global index.
+
+ Example:
+
+ .. code-block:: python
+
+ cpp_index_common_prefix = [
+ 'awesome_lib::',
+ ]
.. versionadded:: 1.5
+.. confval:: cpp_maximum_signature_line_length
+ :type: :code-py:`int | None`
+ :default: :code-py:`None`
+
+ If a signature's length in characters exceeds the number set,
+ each parameter within the signature will be displayed on
+ an individual logical line.
+
+ When :code-py:`None`, there is no maximum length and the entire
+ signature will be displayed on a single logical line.
+
+ This is a domain-specific setting,
+ overriding :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
.. confval:: cpp_paren_attributes
+ :type: :code-py:`Sequence[str]`
+ :default: :code-py:`()`
+
+ A sequence of strings that the parser should additionally accept
+ as attributes with one argument.
+ That is, if ``my_align_as`` is in the list,
+ then :code-cpp:`my_align_as(X)` is parsed as an attribute
+ for all strings ``X`` that have balanced braces
+ (:code-cpp:`()`, :code-cpp:`[]`, and :code-cpp:`{}`).
+ For example, this can be used when :code-cpp:`#define`
+ has been used for attributes, for portability.
- A list of strings that the parser additionally should accept as attributes
- with one argument. That is, if ``my_align_as`` is in the list, then
- ``my_align_as(X)`` is parsed as an attribute for all strings ``X`` that have
- balanced braces (``()``, ``[]``, and ``{}``). This can for example be used
- when attributes have been ``#define`` d for portability.
+ Example:
+
+ .. code-block:: python
+
+ cpp_paren_attributes = [
+ 'my_align_as',
+ ]
.. versionadded:: 1.5
+ .. versionchanged:: 7.4
+ :confval:`!cpp_paren_attributes` can now be a tuple.
-.. confval:: cpp_maximum_signature_line_length
- If a signature's length in characters exceeds the number set, each
- parameter will be displayed on an individual logical line. This is a
- domain-specific setting, overriding :confval:`maximum_signature_line_length`.
+Options for the Javascript domain
+---------------------------------
+
+.. confval:: javascript_maximum_signature_line_length
+ :type: :code-py:`int | None`
+ :default: :code-py:`None`
+
+ If a signature's length in characters exceeds the number set,
+ each parameter within the signature will be displayed on
+ an individual logical line.
+
+ When :code-py:`None`, there is no maximum length and the entire
+ signature will be displayed on a single logical line.
+
+ This is a domain-specific setting,
+ overriding :confval:`maximum_signature_line_length`.
.. versionadded:: 7.1
+
Options for the Python domain
-----------------------------
+.. confval:: add_module_names
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
+
+ A boolean that decides whether module names are prepended
+ to all :term:`object` names
+ (for object types where a "module" of some kind is defined),
+ e.g. for :rst:dir:`py:function` directives.
+
+.. confval:: modindex_common_prefix
+ :type: :code-py:`list[str]`
+ :default: :code-py:`[]`
+
+ A list of prefixes that are ignored for sorting the Python module index
+ (e.g., if this is set to :code-py:`['foo.']`,
+ then ``foo.bar`` is shown under ``B``, not ``F``).
+ This can be handy if you document a project that consists of a
+ single package.
+
+ .. caution::
+ Works only for the HTML builder currently.
+
+ .. versionadded:: 0.6
+
.. confval:: python_display_short_literal_types
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
This value controls how :py:data:`~typing.Literal` types are displayed.
- The setting is a boolean, default ``False``.
Examples
~~~~~~~~
The examples below use the following :rst:dir:`py:function` directive:
- .. code:: reStructuredText
+ .. code-block:: rst
.. py:function:: serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
- When ``False``, :py:data:`~typing.Literal` types display as per standard
+ When :code-py:`False`, :py:data:`~typing.Literal` types display as per standard
Python syntax, i.e.:
- .. code:: python
+ .. code-block:: python
- serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
+ serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
- When ``True``, :py:data:`~typing.Literal` types display with a short,
+ When :code-py:`True`, :py:data:`~typing.Literal` types display with a short,
:PEP:`604`-inspired syntax, i.e.:
- .. code:: python
+ .. code-block:: python
- serve_food(item: "egg" | "spam" | "lobster thermidor") -> None
+ serve_food(item: "egg" | "spam" | "lobster thermidor") -> None
.. versionadded:: 6.2
-.. confval:: python_use_unqualified_type_names
-
- If true, suppress the module name of the python reference if it can be
- resolved. The default is ``False``.
-
- .. versionadded:: 4.0
-
- .. note:: This configuration is still in experimental
-
.. confval:: python_maximum_signature_line_length
+ :type: :code-py:`int | None`
+ :default: :code-py:`None`
If a signature's length in characters exceeds the number set,
- each argument or type parameter will be displayed on an individual logical line.
+ each parameter within the signature will be displayed on
+ an individual logical line.
+
+ When :code-py:`None`, there is no maximum length and the entire
+ signature will be displayed on a single logical line.
+
This is a domain-specific setting,
overriding :confval:`maximum_signature_line_length`.
@@ -3066,29 +4094,80 @@ Options for the Python domain
for the latter, the signature length ignores the length of
the type parameters list.
- For instance, with `python_maximum_signature_line_length = 20`,
+ For instance, with :code-py:`python_maximum_signature_line_length = 20`,
only the list of type parameters will be wrapped
while the arguments list will be rendered on a single line
- .. code:: rst
+ .. code-block:: rst
.. py:function:: add[T: VERY_LONG_SUPER_TYPE, U: VERY_LONG_SUPER_TYPE](a: T, b: U)
.. versionadded:: 7.1
-Options for the Javascript domain
----------------------------------
+.. confval:: python_use_unqualified_type_names
+ :type: :code-py:`bool`
+ :default: :code-py:`False`
-.. confval:: javascript_maximum_signature_line_length
+ Suppress the module name of the python reference if it can be resolved.
- If a signature's length in characters exceeds the number set, each
- parameter will be displayed on an individual logical line. This is a
- domain-specific setting, overriding :confval:`maximum_signature_line_length`.
+ .. versionadded:: 4.0
- .. versionadded:: 7.1
+ .. caution::
+ This feature is experimental.
-Example of configuration file
------------------------------
+.. confval:: trim_doctest_flags
+ :type: :code-py:`bool`
+ :default: :code-py:`True`
+
+ Remove doctest flags (comments looking like :code-py:`# doctest: FLAG, ...`)
+ at the ends of lines and ``<BLANKLINE>`` markers for all code
+ blocks showing interactive Python sessions (i.e. doctests).
+ See the extension :mod:`~sphinx.ext.doctest` for more
+ possibilities of including doctests.
+
+ .. versionadded:: 1.0
+ .. versionchanged:: 1.1
+ Now also removes ``<BLANKLINE>``.
+
+
+Extension options
+=================
+
+Extensions frequently have their own configuration options.
+Those for Sphinx's first-party extensions are documented
+in each :doc:`extension's page </usage/extensions/index>`.
+
+
+Example configuration file
+==========================
+
+.. code-block:: python
+
+ # -- Project information -----------------------------------------------------
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
+
+ project = 'Test Project'
+ copyright = '2000-2042, The Test Project Authors'
+ author = 'The Authors'
+ version = release = '4.16'
+
+ # -- General configuration ------------------------------------------------
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
+
+ exclude_patterns = [
+ '_build',
+ 'Thumbs.db',
+ '.DS_Store',
+ ]
+ extensions = []
+ language = 'en'
+ master_doc = 'index'
+ pygments_style = 'sphinx'
+ source_suffix = '.rst'
+ templates_path = ['_templates']
+
+ # -- Options for HTML output ----------------------------------------------
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
-.. literalinclude:: /_static/conf.py.txt
- :language: python
+ html_theme = 'alabaster'
+ html_static_path = ['_static']
diff --git a/doc/usage/domains/c.rst b/doc/usage/domains/c.rst
new file mode 100644
index 0000000..49aa5ca
--- /dev/null
+++ b/doc/usage/domains/c.rst
@@ -0,0 +1,367 @@
+.. highlight:: rst
+
+============
+The C Domain
+============
+
+.. versionadded:: 1.0
+
+The C domain (name **c**) is suited for documentation of C API.
+
+.. rst:directive:: .. c:member:: declaration
+ .. c:var:: declaration
+
+ Describes a C struct member or variable. Example signature::
+
+ .. c:member:: PyObject *PyTypeObject.tp_bases
+
+ The difference between the two directives is only cosmetic.
+
+.. rst:directive:: .. c:function:: function prototype
+
+ Describes a C function. The signature should be given as in C, e.g.::
+
+ .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
+
+ Note that you don't have to backslash-escape asterisks in the signature, as
+ it is not parsed by the reStructuredText inliner.
+
+ In the description of a function you can use the following info fields
+ (see also :ref:`info-field-lists`).
+
+ * ``param``, ``parameter``, ``arg``, ``argument``,
+ Description of a parameter.
+ * ``type``: Type of a parameter,
+ written as if passed to the :rst:role:`c:expr` role.
+ * ``returns``, ``return``: Description of the return value.
+ * ``rtype``: Return type,
+ written as if passed to the :rst:role:`c:expr` role.
+ * ``retval``, ``retvals``: An alternative to ``returns`` for describing
+ the result of the function.
+
+ .. versionadded:: 4.3
+ The ``retval`` field type.
+
+ For example::
+
+ .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
+
+ :param type: description of the first parameter.
+ :param nitems: description of the second parameter.
+ :returns: a result.
+ :retval NULL: under some conditions.
+ :retval NULL: under some other conditions as well.
+
+ which renders as
+
+ .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
+
+ ..
+ ** for some editors (e.g., vim) to stop bold-highlighting the source
+
+ :no-contents-entry:
+ :no-index-entry:
+ :param type: description of the first parameter.
+ :param nitems: description of the second parameter.
+ :returns: a result.
+ :retval NULL: under some conditions.
+ :retval NULL: under some other conditions as well.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's parameters will be emitted on a single logical
+ line, overriding :confval:`c_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+
+.. rst:directive:: .. c:macro:: name
+ .. c:macro:: name(arg list)
+
+ Describes a C macro, i.e., a C-language ``#define``, without the replacement
+ text.
+
+ In the description of a macro you can use the same info fields as for the
+ :rst:dir:`c:function` directive.
+
+ .. versionadded:: 3.0
+ The function style variant.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the macro's parameters will be emitted on a single logical
+ line, overriding :confval:`c_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. c:struct:: name
+
+ Describes a C struct.
+
+ .. versionadded:: 3.0
+
+.. rst:directive:: .. c:union:: name
+
+ Describes a C union.
+
+ .. versionadded:: 3.0
+
+.. rst:directive:: .. c:enum:: name
+
+ Describes a C enum.
+
+ .. versionadded:: 3.0
+
+.. rst:directive:: .. c:enumerator:: name
+
+ Describes a C enumerator.
+
+ .. versionadded:: 3.0
+
+.. rst:directive:: .. c:type:: typedef-like declaration
+ .. c:type:: name
+
+ Describes a C type, either as a typedef, or the alias for an unspecified
+ type.
+
+.. _c-xref-roles:
+
+Cross-referencing C constructs
+------------------------------
+
+The following roles create cross-references to C-language constructs if they
+are defined in the documentation:
+
+.. rst:role:: c:member
+ c:data
+ c:var
+ c:func
+ c:macro
+ c:struct
+ c:union
+ c:enum
+ c:enumerator
+ c:type
+
+ Reference a C declaration, as defined above.
+ Note that :rst:role:`c:member`, :rst:role:`c:data`, and
+ :rst:role:`c:var` are equivalent.
+
+ .. versionadded:: 3.0
+ The var, struct, union, enum, and enumerator roles.
+
+
+Anonymous Entities
+------------------
+
+C supports anonymous structs, enums, and unions.
+For the sake of documentation they must be given some name that starts with
+``@``, e.g., ``@42`` or ``@data``.
+These names can also be used in cross-references,
+though nested symbols will be found even when omitted.
+The ``@...`` name will always be rendered as **[anonymous]** (possibly as a
+link).
+
+Example::
+
+ .. c:struct:: Data
+
+ .. c:union:: @data
+
+ .. c:var:: int a
+
+ .. c:var:: double b
+
+ Explicit ref: :c:var:`Data.@data.a`. Short-hand ref: :c:var:`Data.a`.
+
+This will be rendered as:
+
+.. c:struct:: Data
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:union:: @data
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:var:: int a
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:var:: double b
+ :no-contents-entry:
+ :no-index-entry:
+
+Explicit ref: :c:var:`Data.@data.a`. Short-hand ref: :c:var:`Data.a`.
+
+.. versionadded:: 3.0
+
+
+Aliasing Declarations
+---------------------
+
+.. c:namespace-push:: @alias
+
+Sometimes it may be helpful list declarations elsewhere than their main
+documentation, e.g., when creating a synopsis of an interface.
+The following directive can be used for this purpose.
+
+.. rst:directive:: .. c:alias:: name
+
+ Insert one or more alias declarations. Each entity can be specified
+ as they can in the :rst:role:`c:any` role.
+
+ For example::
+
+ .. c:var:: int data
+ .. c:function:: int f(double k)
+
+ .. c:alias:: data
+ f
+
+ becomes
+
+ .. c:var:: int data
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:function:: int f(double k)
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:alias:: data
+ f
+
+ .. versionadded:: 3.2
+
+
+ .. rubric:: Options
+
+ .. rst:directive:option:: maxdepth: int
+
+ Insert nested declarations as well, up to the total depth given.
+ Use 0 for infinite depth and 1 for just the mentioned declaration.
+ Defaults to 1.
+
+ .. versionadded:: 3.3
+
+ .. rst:directive:option:: noroot
+
+ Skip the mentioned declarations and only render nested declarations.
+ Requires ``maxdepth`` either 0 or at least 2.
+
+ .. versionadded:: 3.5
+
+
+.. c:namespace-pop::
+
+
+Inline Expressions and Types
+----------------------------
+
+.. rst:role:: c:expr
+ c:texpr
+
+ Insert a C expression or type either as inline code (``cpp:expr``)
+ or inline text (``cpp:texpr``). For example::
+
+ .. c:var:: int a = 42
+
+ .. c:function:: int f(int i)
+
+ An expression: :c:expr:`a * f(a)` (or as text: :c:texpr:`a * f(a)`).
+
+ A type: :c:expr:`const Data*`
+ (or as text :c:texpr:`const Data*`).
+
+ will be rendered as follows:
+
+ .. c:var:: int a = 42
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. c:function:: int f(int i)
+ :no-contents-entry:
+ :no-index-entry:
+
+ An expression: :c:expr:`a * f(a)` (or as text: :c:texpr:`a * f(a)`).
+
+ A type: :c:expr:`const Data*`
+ (or as text :c:texpr:`const Data*`).
+
+ .. versionadded:: 3.0
+
+
+Namespacing
+-----------
+
+.. versionadded:: 3.1
+
+The C language it self does not support namespacing, but it can sometimes be
+useful to emulate it in documentation, e.g., to show alternate declarations.
+The feature may also be used to document members of structs/unions/enums
+separate from their parent declaration.
+
+The current scope can be changed using three namespace directives. They manage
+a stack declarations where ``c:namespace`` resets the stack and changes a given
+scope.
+
+The ``c:namespace-push`` directive changes the scope to a given inner scope
+of the current one.
+
+The ``c:namespace-pop`` directive undoes the most recent
+``c:namespace-push`` directive.
+
+.. rst:directive:: .. c:namespace:: scope specification
+
+ Changes the current scope for the subsequent objects to the given scope, and
+ resets the namespace directive stack. Note that nested scopes can be
+ specified by separating with a dot, e.g.::
+
+ .. c:namespace:: Namespace1.Namespace2.SomeStruct.AnInnerStruct
+
+ All subsequent objects will be defined as if their name were declared with
+ the scope prepended. The subsequent cross-references will be searched for
+ starting in the current scope.
+
+ Using ``NULL`` or ``0`` as the scope will change to global scope.
+
+.. rst:directive:: .. c:namespace-push:: scope specification
+
+ Change the scope relatively to the current scope. For example, after::
+
+ .. c:namespace:: A.B
+
+ .. c:namespace-push:: C.D
+
+ the current scope will be ``A.B.C.D``.
+
+.. rst:directive:: .. c:namespace-pop::
+
+ Undo the previous ``c:namespace-push`` directive (*not* just pop a scope).
+ For example, after::
+
+ .. c:namespace:: A.B
+
+ .. c:namespace-push:: C.D
+
+ .. c:namespace-pop::
+
+ the current scope will be ``A.B`` (*not* ``A.B.C``).
+
+ If no previous ``c:namespace-push`` directive has been used, but only a
+ ``c:namespace`` directive, then the current scope will be reset to global
+ scope. That is, ``.. c:namespace:: A.B`` is equivalent to::
+
+ .. c:namespace:: NULL
+
+ .. c:namespace-push:: A.B
+
+Configuration Variables
+-----------------------
+
+See :ref:`c-config`.
diff --git a/doc/usage/domains/cpp.rst b/doc/usage/domains/cpp.rst
new file mode 100644
index 0000000..57cb932
--- /dev/null
+++ b/doc/usage/domains/cpp.rst
@@ -0,0 +1,760 @@
+.. highlight:: rst
+
+==============
+The C++ Domain
+==============
+
+.. versionadded:: 1.0
+
+The C++ domain (name **cpp**) supports documenting C++ projects.
+
+Directives for Declaring Entities
+---------------------------------
+
+The following directives are available. All declarations can start with a
+visibility statement (``public``, ``private`` or ``protected``).
+
+.. rst:directive:: .. cpp:class:: class specifier
+ .. cpp:struct:: class specifier
+
+ Describe a class/struct, possibly with specification of inheritance, e.g.,::
+
+ .. cpp:class:: MyClass : public MyBase, MyOtherBase
+
+ The difference between :rst:dir:`cpp:class` and :rst:dir:`cpp:struct` is
+ only cosmetic: the prefix rendered in the output, and the specifier shown
+ in the index.
+
+ The class can be directly declared inside a nested scope, e.g.,::
+
+ .. cpp:class:: OuterScope::MyClass : public MyBase, MyOtherBase
+
+ A class template can be declared::
+
+ .. cpp:class:: template<typename T, std::size_t N> std::array
+
+ or with a line break::
+
+ .. cpp:class:: template<typename T, std::size_t N> \
+ std::array
+
+ Full and partial template specialisations can be declared::
+
+ .. cpp:class:: template<> \
+ std::array<bool, 256>
+
+ .. cpp:class:: template<typename T> \
+ std::array<T, 42>
+
+ .. versionadded:: 2.0
+ The :rst:dir:`cpp:struct` directive.
+
+.. rst:directive:: .. cpp:function:: (member) function prototype
+
+ Describe a function or member function, e.g.,::
+
+ .. cpp:function:: bool myMethod(int arg1, std::string arg2)
+
+ A function with parameters and types.
+
+ .. cpp:function:: bool myMethod(int, double)
+
+ A function with unnamed parameters.
+
+ .. cpp:function:: const T &MyClass::operator[](std::size_t i) const
+
+ An overload for the indexing operator.
+
+ .. cpp:function:: operator bool() const
+
+ A casting operator.
+
+ .. cpp:function:: constexpr void foo(std::string &bar[2]) noexcept
+
+ A constexpr function.
+
+ .. cpp:function:: MyClass::MyClass(const MyClass&) = default
+
+ A copy constructor with default implementation.
+
+ Function templates can also be described::
+
+ .. cpp:function:: template<typename U> \
+ void print(U &&u)
+
+ and function template specialisations::
+
+ .. cpp:function:: template<> \
+ void print(int i)
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's parameters will be emitted on a single logical
+ line, overriding :confval:`cpp_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. cpp:member:: (member) variable declaration
+ .. cpp:var:: (member) variable declaration
+
+ Describe a variable or member variable, e.g.,::
+
+ .. cpp:member:: std::string MyClass::myMember
+
+ .. cpp:var:: std::string MyClass::myOtherMember[N][M]
+
+ .. cpp:member:: int a = 42
+
+ Variable templates can also be described::
+
+ .. cpp:member:: template<class T> \
+ constexpr T pi = T(3.1415926535897932385)
+
+.. rst:directive:: .. cpp:type:: typedef declaration
+ .. cpp:type:: name
+ .. cpp:type:: type alias declaration
+
+ Describe a type as in a typedef declaration, a type alias declaration, or
+ simply the name of a type with unspecified type, e.g.,::
+
+ .. cpp:type:: std::vector<int> MyList
+
+ A typedef-like declaration of a type.
+
+ .. cpp:type:: MyContainer::const_iterator
+
+ Declaration of a type alias with unspecified type.
+
+ .. cpp:type:: MyType = std::unordered_map<int, std::string>
+
+ Declaration of a type alias.
+
+ A type alias can also be templated::
+
+ .. cpp:type:: template<typename T> \
+ MyContainer = std::vector<T>
+
+ The example are rendered as follows.
+
+ .. cpp:type:: std::vector<int> MyList
+ :no-contents-entry:
+ :no-index-entry:
+
+ A typedef-like declaration of a type.
+
+ .. cpp:type:: MyContainer::const_iterator
+ :no-contents-entry:
+ :no-index-entry:
+
+ Declaration of a type alias with unspecified type.
+
+ .. cpp:type:: MyType = std::unordered_map<int, std::string>
+ :no-contents-entry:
+ :no-index-entry:
+
+ Declaration of a type alias.
+
+ .. cpp:type:: template<typename T> \
+ MyContainer = std::vector<T>
+ :no-contents-entry:
+ :no-index-entry:
+
+.. rst:directive:: .. cpp:enum:: unscoped enum declaration
+ .. cpp:enum-struct:: scoped enum declaration
+ .. cpp:enum-class:: scoped enum declaration
+
+ Describe a (scoped) enum, possibly with the underlying type specified. Any
+ enumerators declared inside an unscoped enum will be declared both in the
+ enum scope and in the parent scope. Examples::
+
+ .. cpp:enum:: MyEnum
+
+ An unscoped enum.
+
+ .. cpp:enum:: MySpecificEnum : long
+
+ An unscoped enum with specified underlying type.
+
+ .. cpp:enum-class:: MyScopedEnum
+
+ A scoped enum.
+
+ .. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type<MySpecificEnum>::type
+
+ A scoped enum with non-default visibility, and with a specified
+ underlying type.
+
+.. rst:directive:: .. cpp:enumerator:: name
+ .. cpp:enumerator:: name = constant
+
+ Describe an enumerator, optionally with its value defined, e.g.,::
+
+ .. cpp:enumerator:: MyEnum::myEnumerator
+
+ .. cpp:enumerator:: MyEnum::myOtherEnumerator = 42
+
+.. rst:directive:: .. cpp:union:: name
+
+ Describe a union.
+
+ .. versionadded:: 1.8
+
+.. rst:directive:: .. cpp:concept:: template-parameter-list name
+
+ .. warning:: The support for concepts is experimental. It is based on the
+ current draft standard and the Concepts Technical Specification.
+ The features may change as they evolve.
+
+ Describe a concept. It must have exactly 1 template parameter list. The name
+ may be a nested name. Example::
+
+ .. cpp:concept:: template<typename It> std::Iterator
+
+ Proxy to an element of a notional sequence that can be compared,
+ indirected, or incremented.
+
+ **Notation**
+
+ .. cpp:var:: It r
+
+ An lvalue.
+
+ **Valid Expressions**
+
+ - :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
+ - :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when
+ :cpp:expr:`r` is incrementable.
+
+ This will render as follows:
+
+ .. cpp:concept:: template<typename It> std::Iterator
+ :no-contents-entry:
+ :no-index-entry:
+
+ Proxy to an element of a notional sequence that can be compared,
+ indirected, or incremented.
+
+ **Notation**
+
+ .. cpp:var:: It r
+
+ An lvalue.
+
+ **Valid Expressions**
+
+ - :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
+ - :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r`
+ is incrementable.
+
+ .. versionadded:: 1.5
+
+
+Options
+~~~~~~~
+
+Some directives support options:
+
+- ``:no-index-entry:`` and ``:no-contents-entry:``, see :ref:`basic-domain-markup`.
+- ``:tparam-line-spec:``, for templated declarations.
+ If specified, each template parameter will be rendered on a separate line.
+
+ .. versionadded:: 1.6
+
+Anonymous Entities
+------------------
+
+C++ supports anonymous namespaces, classes, enums, and unions.
+For the sake of documentation they must be given some name that starts with
+``@``, e.g., ``@42`` or ``@data``.
+These names can also be used in cross-references and (type) expressions,
+though nested symbols will be found even when omitted.
+The ``@...`` name will always be rendered as **[anonymous]** (possibly as a
+link).
+
+Example::
+
+ .. cpp:class:: Data
+
+ .. cpp:union:: @data
+
+ .. cpp:var:: int a
+
+ .. cpp:var:: double b
+
+ Explicit ref: :cpp:var:`Data::@data::a`. Short-hand ref: :cpp:var:`Data::a`.
+
+This will be rendered as:
+
+.. cpp:class:: Data
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:union:: @data
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:var:: int a
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:var:: double b
+ :no-contents-entry:
+ :no-index-entry:
+
+Explicit ref: :cpp:var:`Data::@data::a`. Short-hand ref: :cpp:var:`Data::a`.
+
+.. versionadded:: 1.8
+
+
+Aliasing Declarations
+---------------------
+
+Sometimes it may be helpful list declarations elsewhere than their main
+documentation, e.g., when creating a synopsis of a class interface.
+The following directive can be used for this purpose.
+
+.. rst:directive:: .. cpp:alias:: name or function signature
+
+ Insert one or more alias declarations. Each entity can be specified
+ as they can in the :rst:role:`cpp:any` role.
+ If the name of a function is given (as opposed to the complete signature),
+ then all overloads of the function will be listed.
+
+ For example::
+
+ .. cpp:alias:: Data::a
+ overload_example::C::f
+
+ becomes
+
+ .. cpp:alias:: Data::a
+ overload_example::C::f
+
+ whereas::
+
+ .. cpp:alias:: void overload_example::C::f(double d) const
+ void overload_example::C::f(double d)
+
+ becomes
+
+ .. cpp:alias:: void overload_example::C::f(double d) const
+ void overload_example::C::f(double d)
+
+ .. versionadded:: 2.0
+
+
+ .. rubric:: Options
+
+ .. rst:directive:option:: maxdepth: int
+
+ Insert nested declarations as well, up to the total depth given.
+ Use 0 for infinite depth and 1 for just the mentioned declaration.
+ Defaults to 1.
+
+ .. versionadded:: 3.5
+
+ .. rst:directive:option:: noroot
+
+ Skip the mentioned declarations and only render nested declarations.
+ Requires ``maxdepth`` either 0 or at least 2.
+
+ .. versionadded:: 3.5
+
+
+Constrained Templates
+---------------------
+
+.. warning:: The support for concepts is experimental. It is based on the
+ current draft standard and the Concepts Technical Specification.
+ The features may change as they evolve.
+
+.. note:: Sphinx does not currently support ``requires`` clauses.
+
+Placeholders
+~~~~~~~~~~~~
+
+Declarations may use the name of a concept to introduce constrained template
+parameters, or the keyword ``auto`` to introduce unconstrained template
+parameters::
+
+ .. cpp:function:: void f(auto &&arg)
+
+ A function template with a single unconstrained template parameter.
+
+ .. cpp:function:: void f(std::Iterator it)
+
+ A function template with a single template parameter, constrained by the
+ Iterator concept.
+
+Template Introductions
+~~~~~~~~~~~~~~~~~~~~~~
+
+Simple constrained function or class templates can be declared with a `template
+introduction` instead of a template parameter list::
+
+ .. cpp:function:: std::Iterator{It} void advance(It &it)
+
+ A function template with a template parameter constrained to be an
+ Iterator.
+
+ .. cpp:class:: std::LessThanComparable{T} MySortedContainer
+
+ A class template with a template parameter constrained to be
+ LessThanComparable.
+
+They are rendered as follows.
+
+.. cpp:function:: std::Iterator{It} void advance(It &it)
+ :no-contents-entry:
+ :no-index-entry:
+
+ A function template with a template parameter constrained to be an Iterator.
+
+.. cpp:class:: std::LessThanComparable{T} MySortedContainer
+ :no-contents-entry:
+ :no-index-entry:
+
+ A class template with a template parameter constrained to be
+ LessThanComparable.
+
+Note however that no checking is performed with respect to parameter
+compatibility. E.g., ``Iterator{A, B, C}`` will be accepted as an introduction
+even though it would not be valid C++.
+
+Inline Expressions and Types
+----------------------------
+
+.. rst:role:: cpp:expr
+ cpp:texpr
+
+ Insert a C++ expression or type either as inline code (``cpp:expr``)
+ or inline text (``cpp:texpr``). For example::
+
+ .. cpp:var:: int a = 42
+
+ .. cpp:function:: int f(int i)
+
+ An expression: :cpp:expr:`a * f(a)` (or as text: :cpp:texpr:`a * f(a)`).
+
+ A type: :cpp:expr:`const MySortedContainer<int>&`
+ (or as text :cpp:texpr:`const MySortedContainer<int>&`).
+
+ will be rendered as follows:
+
+ .. cpp:var:: int a = 42
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:function:: int f(int i)
+ :no-contents-entry:
+ :no-index-entry:
+
+ An expression: :cpp:expr:`a * f(a)` (or as text: :cpp:texpr:`a * f(a)`).
+
+ A type: :cpp:expr:`const MySortedContainer<int>&`
+ (or as text :cpp:texpr:`const MySortedContainer<int>&`).
+
+ .. versionadded:: 1.7
+ The :rst:role:`cpp:expr` role.
+
+ .. versionadded:: 1.8
+ The :rst:role:`cpp:texpr` role.
+
+Namespacing
+-----------
+
+Declarations in the C++ domain are as default placed in global scope. The
+current scope can be changed using three namespace directives. They manage a
+stack declarations where ``cpp:namespace`` resets the stack and changes a given
+scope.
+
+The ``cpp:namespace-push`` directive changes the scope to a given inner scope
+of the current one.
+
+The ``cpp:namespace-pop`` directive undoes the most recent
+``cpp:namespace-push`` directive.
+
+.. rst:directive:: .. cpp:namespace:: scope specification
+
+ Changes the current scope for the subsequent objects to the given scope, and
+ resets the namespace directive stack. Note that the namespace does not need
+ to correspond to C++ namespaces, but can end in names of classes, e.g.,::
+
+ .. cpp:namespace:: Namespace1::Namespace2::SomeClass::AnInnerClass
+
+ All subsequent objects will be defined as if their name were declared with
+ the scope prepended. The subsequent cross-references will be searched for
+ starting in the current scope.
+
+ Using ``NULL``, ``0``, or ``nullptr`` as the scope will change to global
+ scope.
+
+ A namespace declaration can also be templated, e.g.,::
+
+ .. cpp:class:: template<typename T> \
+ std::vector
+
+ .. cpp:namespace:: template<typename T> std::vector
+
+ .. cpp:function:: std::size_t size() const
+
+ declares ``size`` as a member function of the class template
+ ``std::vector``. Equivalently this could have been declared using::
+
+ .. cpp:class:: template<typename T> \
+ std::vector
+
+ .. cpp:function:: std::size_t size() const
+
+ or::
+
+ .. cpp:class:: template<typename T> \
+ std::vector
+
+.. rst:directive:: .. cpp:namespace-push:: scope specification
+
+ Change the scope relatively to the current scope. For example, after::
+
+ .. cpp:namespace:: A::B
+
+ .. cpp:namespace-push:: C::D
+
+ the current scope will be ``A::B::C::D``.
+
+ .. versionadded:: 1.4
+
+.. rst:directive:: .. cpp:namespace-pop::
+
+ Undo the previous ``cpp:namespace-push`` directive (*not* just pop a scope).
+ For example, after::
+
+ .. cpp:namespace:: A::B
+
+ .. cpp:namespace-push:: C::D
+
+ .. cpp:namespace-pop::
+
+ the current scope will be ``A::B`` (*not* ``A::B::C``).
+
+ If no previous ``cpp:namespace-push`` directive has been used, but only a
+ ``cpp:namespace`` directive, then the current scope will be reset to global
+ scope. That is, ``.. cpp:namespace:: A::B`` is equivalent to::
+
+ .. cpp:namespace:: nullptr
+
+ .. cpp:namespace-push:: A::B
+
+ .. versionadded:: 1.4
+
+Info field lists
+----------------
+
+All the C++ directives for declaring entities support the following
+info fields (see also :ref:`info-field-lists`):
+
+* ``tparam``: Description of a template parameter.
+
+The :rst:dir:`cpp:function` directive additionally supports the
+following fields:
+
+* ``param``, ``parameter``, ``arg``, ``argument``: Description of a parameter.
+* ``returns``, ``return``: Description of a return value.
+* ``retval``, ``retvals``: An alternative to ``returns`` for describing
+ the result of the function.
+* ``throws``, ``throw``, ``exception``: Description of a possibly thrown exception.
+
+.. versionadded:: 4.3
+ The ``retval`` field type.
+
+.. _cpp-xref-roles:
+
+Cross-referencing
+-----------------
+
+These roles link to the given declaration types:
+
+.. rst:role:: cpp:any
+ cpp:class
+ cpp:struct
+ cpp:func
+ cpp:member
+ cpp:var
+ cpp:type
+ cpp:concept
+ cpp:enum
+ cpp:enumerator
+
+ Reference a C++ declaration by name (see below for details). The name must
+ be properly qualified relative to the position of the link.
+
+ .. versionadded:: 2.0
+ The :rst:role:`cpp:struct` role as alias for the :rst:role:`cpp:class`
+ role.
+
+.. admonition:: Note on References with Templates Parameters/Arguments
+
+ These roles follow the Sphinx :ref:`xref-syntax` rules. This means care must
+ be taken when referencing a (partial) template specialization, e.g. if the
+ link looks like this: ``:cpp:class:`MyClass<int>```.
+ This is interpreted as a link to ``int`` with a title of ``MyClass``.
+ In this case, escape the opening angle bracket with a backslash,
+ like this: ``:cpp:class:`MyClass\<int>```.
+
+ When a custom title is not needed it may be useful to use the roles for
+ inline expressions, :rst:role:`cpp:expr` and :rst:role:`cpp:texpr`, where
+ angle brackets do not need escaping.
+
+Declarations without template parameters and template arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For linking to non-templated declarations the name must be a nested name, e.g.,
+``f`` or ``MyClass::f``.
+
+
+Overloaded (member) functions
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When a (member) function is referenced using just its name, the reference
+will point to an arbitrary matching overload.
+The :rst:role:`cpp:any` and :rst:role:`cpp:func` roles use an alternative
+format, which simply is a complete function declaration.
+This will resolve to the exact matching overload.
+As example, consider the following class declaration:
+
+.. cpp:namespace-push:: overload_example
+.. cpp:class:: C
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:function:: void f(double d) const
+ :no-contents-entry:
+ :no-index-entry:
+ .. cpp:function:: void f(double d)
+ :no-contents-entry:
+ :no-index-entry:
+ .. cpp:function:: void f(int i)
+ :no-contents-entry:
+ :no-index-entry:
+ .. cpp:function:: void f()
+ :no-contents-entry:
+ :no-index-entry:
+
+References using the :rst:role:`cpp:func` role:
+
+- Arbitrary overload: ``C::f``, :cpp:func:`C::f`
+- Also arbitrary overload: ``C::f()``, :cpp:func:`C::f()`
+- Specific overload: ``void C::f()``, :cpp:func:`void C::f()`
+- Specific overload: ``void C::f(int)``, :cpp:func:`void C::f(int)`
+- Specific overload: ``void C::f(double)``, :cpp:func:`void C::f(double)`
+- Specific overload: ``void C::f(double) const``,
+ :cpp:func:`void C::f(double) const`
+
+Note that the :confval:`add_function_parentheses` configuration variable
+does not influence specific overload references.
+
+.. cpp:namespace-pop::
+
+
+Templated declarations
+~~~~~~~~~~~~~~~~~~~~~~
+
+Assume the following declarations.
+
+.. cpp:class:: Wrapper
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:class:: template<typename TOuter> \
+ Outer
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:class:: template<typename TInner> \
+ Inner
+ :no-contents-entry:
+ :no-index-entry:
+
+In general the reference must include the template parameter declarations,
+and template arguments for the prefix of qualified names. For example:
+
+- ``template\<typename TOuter> Wrapper::Outer``
+ (:cpp:class:`template\<typename TOuter> Wrapper::Outer`)
+- ``template\<typename TOuter> template\<typename TInner> Wrapper::Outer<TOuter>::Inner``
+ (:cpp:class:`template\<typename TOuter> template\<typename TInner> Wrapper::Outer<TOuter>::Inner`)
+
+Currently the lookup only succeed if the template parameter identifiers are
+equal strings. That is, ``template\<typename UOuter> Wrapper::Outer`` will not
+work.
+
+As a shorthand notation, if a template parameter list is omitted,
+then the lookup will assume either a primary template or a non-template,
+but not a partial template specialisation.
+This means the following references work as well:
+
+- ``Wrapper::Outer``
+ (:cpp:class:`Wrapper::Outer`)
+- ``Wrapper::Outer::Inner``
+ (:cpp:class:`Wrapper::Outer::Inner`)
+- ``template\<typename TInner> Wrapper::Outer::Inner``
+ (:cpp:class:`template\<typename TInner> Wrapper::Outer::Inner`)
+
+(Full) Template Specialisations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Assume the following declarations.
+
+.. cpp:class:: template<typename TOuter> \
+ Outer
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:class:: template<typename TInner> \
+ Inner
+ :no-contents-entry:
+ :no-index-entry:
+
+.. cpp:class:: template<> \
+ Outer<int>
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:class:: template<typename TInner> \
+ Inner
+ :no-contents-entry:
+ :no-index-entry:
+
+ .. cpp:class:: template<> \
+ Inner<bool>
+ :no-contents-entry:
+ :no-index-entry:
+
+In general the reference must include a template parameter list for each
+template argument list. The full specialisation above can therefore be
+referenced with ``template\<> Outer\<int>`` (:cpp:class:`template\<>
+Outer\<int>`) and ``template\<> template\<> Outer\<int>::Inner\<bool>``
+(:cpp:class:`template\<> template\<> Outer\<int>::Inner\<bool>`). As a
+shorthand the empty template parameter list can be omitted, e.g.,
+``Outer\<int>`` (:cpp:class:`Outer\<int>`) and ``Outer\<int>::Inner\<bool>``
+(:cpp:class:`Outer\<int>::Inner\<bool>`).
+
+Partial Template Specialisations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Assume the following declaration.
+
+.. cpp:class:: template<typename T> \
+ Outer<T*>
+ :no-contents-entry:
+ :no-index-entry:
+
+References to partial specialisations must always include the template
+parameter lists, e.g., ``template\<typename T> Outer\<T*>``
+(:cpp:class:`template\<typename T> Outer\<T*>`). Currently the lookup only
+succeed if the template parameter identifiers are equal strings.
+
+Configuration Variables
+-----------------------
+
+See :ref:`cpp-config`.
diff --git a/doc/usage/domains/index.rst b/doc/usage/domains/index.rst
new file mode 100644
index 0000000..8c47134
--- /dev/null
+++ b/doc/usage/domains/index.rst
@@ -0,0 +1,210 @@
+.. highlight:: rst
+
+.. _usage-domains:
+
+=======
+Domains
+=======
+
+.. versionadded:: 1.0
+
+Originally, Sphinx was conceived for a single project, the documentation of the
+Python language. Shortly afterwards, it was made available for everyone as a
+documentation tool, but the documentation of Python modules remained deeply
+built in -- the most fundamental directives, like ``function``, were designed
+for Python objects. Since Sphinx has become somewhat popular, interest
+developed in using it for many different purposes: C/C++ projects, JavaScript,
+or even reStructuredText markup (like in this documentation).
+
+While this was always possible, it is now much easier to easily support
+documentation of projects using different programming languages or even ones
+not supported by the main Sphinx distribution, by providing a **domain** for
+every such purpose.
+
+A domain is a collection of markup (reStructuredText :term:`directive`\ s and
+:term:`role`\ s) to describe and link to :term:`object`\ s belonging together,
+e.g. elements of a programming language. Directive and role names in a domain
+have names like ``domain:name``, e.g. ``py:function``. Domains can also
+provide custom indices (like the Python Module Index).
+
+Having domains means that there are no naming problems when one set of
+documentation wants to refer to e.g. C++ and Python classes. It also means
+that extensions that support the documentation of whole new languages are much
+easier to write.
+
+This section describes what the domains that are included with Sphinx provide.
+The domain API is documented as well, in the section :ref:`domain-api`.
+
+
+.. _basic-domain-markup:
+
+Basic Markup
+------------
+
+Most domains provide a number of :dfn:`object description directives`, used to
+describe specific objects provided by modules. Each directive requires one or
+more signatures to provide basic information about what is being described, and
+the content should be the description.
+
+A domain will typically keep an internal index of all entities to aid
+cross-referencing.
+Typically it will also add entries in the shown general index.
+If you want to suppress the addition of an entry in the shown index, you can
+give the directive option flag ``:no-index-entry:``.
+If you want to exclude the object description from the table of contents, you
+can give the directive option flag ``:no-contents-entry:``.
+If you want to typeset an object description, without even making it available
+for cross-referencing, you can give the directive option flag ``:no-index:``
+(which implies ``:no-index-entry:``).
+If you do not want to typeset anything, you can give the directive option flag
+``:no-typesetting:``. This can for example be used to create only a target and
+index entry for later reference.
+Though, note that not every directive in every domain may support these
+options.
+
+.. versionadded:: 3.2
+ The directive option ``noindexentry`` in the Python, C, C++, and Javascript
+ domains.
+
+.. versionadded:: 5.2.3
+ The directive option ``:nocontentsentry:`` in the Python, C, C++, Javascript,
+ and reStructuredText domains.
+
+.. versionadded:: 7.2
+ The directive option ``no-typesetting`` in the Python, C, C++, Javascript,
+ and reStructuredText domains.
+
+.. versionchanged:: 7.2
+
+ * The directive option ``:noindex:`` was renamed
+ to ``:no-index:``.
+ * The directive option ``:noindexentry:`` was renamed
+ to ``:no-index-entry:``.
+ * The directive option ``:nocontentsentry:`` was renamed
+ to ``:no-contents-entry:``.
+
+ The previous names are retained as aliases,
+ but will be deprecated and removed
+ in a future version of Sphinx.
+
+An example using a Python domain directive::
+
+ .. py:function:: spam(eggs)
+ ham(eggs)
+
+ Spam or ham the foo.
+
+This describes the two Python functions ``spam`` and ``ham``. (Note that when
+signatures become too long, you can break them if you add a backslash to lines
+that are continued in the next line. Example::
+
+ .. py:function:: filterwarnings(action, message='', category=Warning, \
+ module='', lineno=0, append=False)
+ :no-index:
+
+(This example also shows how to use the ``:no-index:`` flag.)
+
+The domains also provide roles that link back to these object descriptions.
+For example, to link to one of the functions described in the example above,
+you could say ::
+
+ The function :py:func:`spam` does a similar thing.
+
+As you can see, both directive and role names contain the domain name and the
+directive name.
+
+The directive option ``:no-typesetting:`` can be used to create a target
+(and index entry) which can later be referenced
+by the roles provided by the domain.
+This is particularly useful for literate programming:
+
+.. code-block:: rst
+
+ .. py:function:: spam(eggs)
+ :no-typesetting:
+
+ .. code:: python
+
+ def spam(eggs):
+ pass
+
+ The function :py:func:`spam` does nothing.
+
+.. rubric:: Default Domain
+
+For documentation describing objects from solely one domain, authors will not
+have to state again its name at each directive, role, etc... after
+having specified a default. This can be done either via the config
+value :confval:`primary_domain` or via this directive:
+
+.. rst:directive:: .. default-domain:: name
+
+ Select a new default domain. While the :confval:`primary_domain` selects a
+ global default, this only has an effect within the same file.
+
+If no other default is selected, the Python domain (named ``py``) is the
+default one, mostly for compatibility with documentation written for older
+versions of Sphinx.
+
+Directives and roles that belong to the default domain can be mentioned without
+giving the domain name, i.e. ::
+
+ .. function:: pyfunc()
+
+ Describes a Python function.
+
+ Reference to :func:`pyfunc`.
+
+Cross-referencing syntax
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+For cross-reference roles provided by domains, the same facilities exist as for
+general cross-references. See :ref:`xref-syntax`.
+
+In short:
+
+* You may supply an explicit title and reference target: ``:role:`title
+ <target>``` will refer to *target*, but the link text will be *title*.
+
+* If you prefix the content with ``!``, no reference/hyperlink will be created.
+
+* If you prefix the content with ``~``, the link text will only be the last
+ component of the target. For example, ``:py:meth:`~Queue.Queue.get``` will
+ refer to ``Queue.Queue.get`` but only display ``get`` as the link text.
+
+Built-in domains
+----------------
+
+The following domains are included within Sphinx:
+
+.. toctree::
+ :maxdepth: 1
+
+ standard
+ c
+ cpp
+ javascript
+ mathematics
+ python
+ restructuredtext
+
+More domains
+------------
+
+There are several third-party domains available as extensions, including:
+
+* `Ada <https://pypi.org/project/sphinxcontrib-adadomain/>`__
+* `Chapel <https://pypi.org/project/sphinxcontrib-chapeldomain/>`__
+* `CoffeeScript <https://pypi.org/project/sphinxcontrib-coffee/>`__
+* `Common Lisp <https://pypi.org/project/sphinxcontrib-cldomain/>`__
+* `dqn <https://pypi.org/project/sphinxcontrib-dqndomain/>`__
+* `Erlang <https://pypi.org/project/sphinxcontrib-erlangdomain/>`__
+* `Go <https://pypi.org/project/sphinxcontrib-golangdomain/>`__
+* `HTTP <https://pypi.org/project/sphinxcontrib-httpdomain/>`__
+* `Jinja <https://pypi.org/project/sphinxcontrib-jinjadomain/>`__
+* `Lasso <https://pypi.org/project/sphinxcontrib-lassodomain/>`__
+* `MATLAB <https://pypi.org/project/sphinxcontrib-matlabdomain/>`__
+* `Operation <https://pypi.org/project/sphinxcontrib-operationdomain/>`__
+* `PHP <https://pypi.org/project/sphinxcontrib-phpdomain/>`__
+* `Ruby <https://pypi.org/project/sphinxcontrib-rubydomain/>`__
+* `Scala <https://pypi.org/project/sphinxcontrib-scaladomain/>`__
diff --git a/doc/usage/domains/javascript.rst b/doc/usage/domains/javascript.rst
new file mode 100644
index 0000000..ba0ff10
--- /dev/null
+++ b/doc/usage/domains/javascript.rst
@@ -0,0 +1,132 @@
+.. highlight:: rst
+
+=====================
+The JavaScript Domain
+=====================
+
+.. versionadded:: 1.0
+
+The JavaScript domain (name **js**) provides the following directives:
+
+.. rst:directive:: .. js:module:: name
+
+ This directive sets the module name for object declarations that follow
+ after. The module name is used in the global module index and in cross
+ references. This directive does not create an object heading like
+ :rst:dir:`py:class` would, for example.
+
+ By default, this directive will create a linkable entity and will cause an
+ entry in the global module index, unless the ``no-index`` option is
+ specified. If this option is specified, the directive will only update the
+ current module name.
+
+ .. versionadded:: 1.6
+ .. versionchanged:: 5.2
+
+ Module directives support body content.
+
+.. rst:directive:: .. js:function:: name(signature)
+
+ Describes a JavaScript function or method. If you want to describe
+ arguments as optional use square brackets as :ref:`documented <signatures>`
+ for Python signatures.
+
+ You can use fields to give more details about arguments and their expected
+ types, errors which may be thrown by the function, and the value being
+ returned::
+
+ .. js:function:: $.getJSON(href, callback[, errback])
+
+ :param string href: An URI to the location of the resource.
+ :param callback: Gets called with the object.
+ :param errback:
+ Gets called in case the request fails. And a lot of other
+ text so we need multiple lines.
+ :throws SomeError: For whatever reason in that case.
+ :returns: Something.
+
+ This is rendered as:
+
+ .. js:function:: $.getJSON(href, callback[, errback])
+ :no-contents-entry:
+ :no-index-entry:
+
+ :param string href: An URI to the location of the resource.
+ :param callback: Gets called with the object.
+ :param errback:
+ Gets called in case the request fails. And a lot of other
+ text so we need multiple lines.
+ :throws SomeError: For whatever reason in that case.
+ :returns: Something.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's parameters will be emitted on a single logical
+ line, overriding :confval:`javascript_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. js:method:: name(signature)
+
+ This directive is an alias for :rst:dir:`js:function`, however it describes
+ a function that is implemented as a method on a class object.
+
+ .. versionadded:: 1.6
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's parameters will be emitted on a single logical
+ line, overriding :confval:`javascript_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. js:class:: name
+
+ Describes a constructor that creates an object. This is basically like a
+ function but will show up with a `class` prefix::
+
+ .. js:class:: MyAnimal(name[, age])
+
+ :param string name: The name of the animal
+ :param number age: an optional age for the animal
+
+ This is rendered as:
+
+ .. js:class:: MyAnimal(name[, age])
+ :no-contents-entry:
+ :no-index-entry:
+
+ :param string name: The name of the animal
+ :param number age: an optional age for the animal
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's parameters will be emitted on a single logical
+ line, overriding :confval:`javascript_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. js:data:: name
+
+ Describes a global variable or constant.
+
+.. rst:directive:: .. js:attribute:: object.name
+
+ Describes the attribute *name* of *object*.
+
+.. _js-xref-roles:
+
+These roles are provided to refer to the described objects:
+
+.. rst:role:: js:mod
+ js:func
+ js:meth
+ js:class
+ js:data
+ js:attr
diff --git a/doc/usage/domains/mathematics.rst b/doc/usage/domains/mathematics.rst
new file mode 100644
index 0000000..9f02c6d
--- /dev/null
+++ b/doc/usage/domains/mathematics.rst
@@ -0,0 +1,22 @@
+.. highlight:: rst
+
+======================
+The Mathematics Domain
+======================
+
+.. versionadded:: 1.8
+
+The math domain (name **math**) provides the following roles:
+
+.. rst:role:: math:numref
+
+ Role for cross-referencing equations defined by :rst:dir:`math` directive
+ via their label. Example::
+
+ .. math:: e^{i\pi} + 1 = 0
+ :label: euler
+
+ Euler's identity, equation :math:numref:`euler`, was elected one of the
+ most beautiful mathematical formulas.
+
+ .. versionadded:: 1.8
diff --git a/doc/usage/domains/python.rst b/doc/usage/domains/python.rst
new file mode 100644
index 0000000..5b98baa
--- /dev/null
+++ b/doc/usage/domains/python.rst
@@ -0,0 +1,744 @@
+.. highlight:: rst
+
+=================
+The Python Domain
+=================
+
+.. versionadded:: 1.0
+
+The Python domain (name **py**) provides the following directives for module
+declarations:
+
+.. rst:directive:: .. py:module:: name
+
+ This directive marks the beginning of the description of a module (or package
+ submodule, in which case the name should be fully qualified, including the
+ package name). A description of the module such as the docstring can be
+ placed in the body of the directive.
+
+ This directive will also cause an entry in the global module index.
+
+ .. versionchanged:: 5.2
+
+ Module directives support body content.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: platform: platforms
+ :type: comma separated list
+
+ Indicate platforms which the module is available (if it is available on
+ all platforms, the option should be omitted). The keys are short
+ identifiers; examples that are in use include "IRIX", "Mac", "Windows"
+ and "Unix". It is important to use a key which has already been used when
+ applicable.
+
+ .. rst:directive:option:: synopsis: purpose
+ :type: text
+
+ Consist of one sentence describing the module's purpose -- it is currently
+ only used in the Global Module Index.
+
+ .. rst:directive:option:: deprecated
+ :type: no argument
+
+ Mark a module as deprecated; it will be designated as such in various
+ locations then.
+
+
+.. rst:directive:: .. py:currentmodule:: name
+
+ This directive tells Sphinx that the classes, functions etc. documented from
+ here are in the given module (like :rst:dir:`py:module`), but it will not
+ create index entries, an entry in the Global Module Index, or a link target
+ for :rst:role:`py:mod`. This is helpful in situations where documentation
+ for things in a module is spread over multiple files or sections -- one
+ location has the :rst:dir:`py:module` directive, the others only
+ :rst:dir:`py:currentmodule`.
+
+The following directives are provided for module and class contents:
+
+.. rst:directive:: .. py:function:: name(parameters)
+ .. py:function:: name[type parameters](parameters)
+
+ Describes a module-level function.
+ The signature should include the parameters,
+ together with optional type parameters,
+ as given in the Python function definition, see :ref:`signatures`.
+ For example::
+
+ .. py:function:: Timer.repeat(repeat=3, number=1_000_000)
+ .. py:function:: add[T](a: T, b: T) -> T
+
+ For methods you should use :rst:dir:`py:method`.
+
+ The description normally includes information about the parameters required
+ and how they are used (especially whether mutable objects passed as
+ parameters are modified), side effects, and possible exceptions.
+
+ This information can (in any ``py`` directive) optionally be given in a
+ structured form, see :ref:`info-field-lists`.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: async
+ :type: no value
+
+ Indicate the function is an async function.
+
+ .. versionadded:: 2.1
+
+ .. rst:directive:option:: canonical
+ :type: full qualified name including module name
+
+ Describe the location where the object is defined if the object is
+ imported from other modules
+
+ .. versionadded:: 4.0
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the function's arguments will be emitted on a single logical
+ line, overriding :confval:`python_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+ .. rst:directive:option:: single-line-type-parameter-list
+ :type: no value
+
+ Ensure that the function's type parameters are emitted on a single
+ logical line, overriding :confval:`python_maximum_signature_line_length`
+ and :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+
+.. rst:directive:: .. py:data:: name
+
+ Describes global data in a module, including both variables and values used
+ as "defined constants."
+ Consider using :rst:dir:`py:type` for type aliases instead
+ and :rst:dir:`py:attribute` for class variables and instance attributes.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: type: type of the variable
+ :type: text
+
+ .. versionadded:: 2.4
+
+ .. rst:directive:option:: value: initial value of the variable
+ :type: text
+
+ .. versionadded:: 2.4
+
+ .. rst:directive:option:: canonical
+ :type: full qualified name including module name
+
+ Describe the location where the object is defined if the object is
+ imported from other modules
+
+ .. versionadded:: 4.0
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+.. rst:directive:: .. py:exception:: name
+ .. py:exception:: name(parameters)
+ .. py:exception:: name[type parameters](parameters)
+
+ Describes an exception class.
+ The signature can, but need not include parentheses with constructor arguments,
+ or may optionally include type parameters (see :pep:`695`).
+
+ .. rubric:: options
+
+ .. rst:directive:option:: final
+ :type: no value
+
+ Indicate the class is a final class.
+
+ .. versionadded:: 3.1
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ See :rst:dir:`py:class:single-line-parameter-list`.
+
+ .. versionadded:: 7.1
+
+ .. rst:directive:option:: single-line-type-parameter-list
+ :type: no value
+
+ See :rst:dir:`py:class:single-line-type-parameter-list`.
+
+ .. versionadded:: 7.1
+
+.. rst:directive:: .. py:class:: name
+ .. py:class:: name(parameters)
+ .. py:class:: name[type parameters](parameters)
+
+ Describes a class.
+ The signature can optionally include type parameters (see :pep:`695`)
+ or parentheses with parameters which will be shown as the constructor arguments.
+ See also :ref:`signatures`.
+
+ Methods and attributes belonging to the class should be placed in this
+ directive's body. If they are placed outside, the supplied name should
+ contain the class name so that cross-references still work. Example::
+
+ .. py:class:: Foo
+
+ .. py:method:: quux()
+
+ -- or --
+
+ .. py:class:: Bar
+
+ .. py:method:: Bar.quux()
+
+ The first way is the preferred one.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: canonical
+ :type: full qualified name including module name
+
+ Describe the location where the object is defined if the object is
+ imported from other modules
+
+ .. versionadded:: 4.0
+
+ .. rst:directive:option:: final
+ :type: no value
+
+ Indicate the class is a final class.
+
+ .. versionadded:: 3.1
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the class constructor's arguments will be emitted on a single
+ logical line, overriding :confval:`python_maximum_signature_line_length`
+ and :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+ .. rst:directive:option:: single-line-type-parameter-list
+ :type: no value
+
+ Ensure that the class type parameters are emitted on a single logical
+ line, overriding :confval:`python_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+.. rst:directive:: .. py:attribute:: name
+
+ Describes an object data attribute. The description should include
+ information about the type of the data to be expected and whether it may be
+ changed directly.
+ Type aliases should be documented with :rst:dir:`py:type`.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: type: type of the attribute
+ :type: text
+
+ .. versionadded:: 2.4
+
+ .. rst:directive:option:: value: initial value of the attribute
+ :type: text
+
+ .. versionadded:: 2.4
+
+ .. rst:directive:option:: canonical
+ :type: full qualified name including module name
+
+ Describe the location where the object is defined if the object is
+ imported from other modules
+
+ .. versionadded:: 4.0
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+.. rst:directive:: .. py:property:: name
+
+ Describes an object property.
+
+ .. versionadded:: 4.0
+
+ .. rubric:: options
+
+ .. rst:directive:option:: abstractmethod
+ :type: no value
+
+ Indicate the property is abstract.
+
+ .. rst:directive:option:: classmethod
+ :type: no value
+
+ Indicate the property is a classmethod.
+
+ .. versionadded:: 4.2
+
+ .. rst:directive:option:: type: type of the property
+ :type: text
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+.. rst:directive:: .. py:type:: name
+
+ Describe a :ref:`type alias <python:type-aliases>`.
+
+ The type that the alias represents should be described
+ with the :rst:dir:`!canonical` option.
+ This directive supports an optional description body.
+
+ For example:
+
+ .. code-block:: rst
+
+ .. py:type:: UInt64
+
+ Represent a 64-bit positive integer.
+
+ will be rendered as follows:
+
+ .. py:type:: UInt64
+ :no-contents-entry:
+ :no-index-entry:
+
+ Represent a 64-bit positive integer.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: canonical
+ :type: text
+
+ The canonical type represented by this alias, for example:
+
+ .. code-block:: rst
+
+ .. py:type:: StrPattern
+ :canonical: str | re.Pattern[str]
+
+ Represent a regular expression or a compiled pattern.
+
+ This is rendered as:
+
+ .. py:type:: StrPattern
+ :no-contents-entry:
+ :no-index-entry:
+ :canonical: str | re.Pattern[str]
+
+ Represent a regular expression or a compiled pattern.
+
+ .. versionadded:: 7.4
+
+.. rst:directive:: .. py:method:: name(parameters)
+ .. py:method:: name[type parameters](parameters)
+
+ Describes an object method. The parameters should not include the ``self``
+ parameter. The description should include similar information to that
+ described for ``function``. See also :ref:`signatures` and
+ :ref:`info-field-lists`.
+
+ .. rubric:: options
+
+ .. rst:directive:option:: abstractmethod
+ :type: no value
+
+ Indicate the method is an abstract method.
+
+ .. versionadded:: 2.1
+
+ .. rst:directive:option:: async
+ :type: no value
+
+ Indicate the method is an async method.
+
+ .. versionadded:: 2.1
+
+ .. rst:directive:option:: canonical
+ :type: full qualified name including module name
+
+ Describe the location where the object is defined if the object is
+ imported from other modules
+
+ .. versionadded:: 4.0
+
+ .. rst:directive:option:: classmethod
+ :type: no value
+
+ Indicate the method is a class method.
+
+ .. versionadded:: 2.1
+
+ .. rst:directive:option:: final
+ :type: no value
+
+ Indicate the method is a final method.
+
+ .. versionadded:: 3.1
+
+ .. rst::directive:option:: module
+ :type: text
+
+ Describe the location where the object is defined. The default value is
+ the module specified by :rst:dir:`py:currentmodule`.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the method's arguments will be emitted on a single logical
+ line, overriding :confval:`python_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+ .. rst:directive:option:: single-line-type-parameter-list
+ :type: no value
+
+ Ensure that the method's type parameters are emitted on a single logical
+ line, overriding :confval:`python_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.2
+
+ .. rst:directive:option:: staticmethod
+ :type: no value
+
+ Indicate the method is a static method.
+
+ .. versionadded:: 2.1
+
+
+.. rst:directive:: .. py:staticmethod:: name(parameters)
+ .. py:staticmethod:: name[type parameters](parameters)
+
+ Like :rst:dir:`py:method`, but indicates that the method is a static method.
+
+ .. versionadded:: 0.4
+
+.. rst:directive:: .. py:classmethod:: name(parameters)
+ .. py:classmethod:: name[type parameters](parameters)
+
+ Like :rst:dir:`py:method`, but indicates that the method is a class method.
+
+ .. versionadded:: 0.6
+
+.. rst:directive:: .. py:decorator:: name
+ .. py:decorator:: name(parameters)
+ .. py:decorator:: name[type parameters](parameters)
+
+ Describes a decorator function. The signature should represent the usage as
+ a decorator. For example, given the functions
+
+ .. code-block:: python
+
+ def removename(func):
+ func.__name__ = ''
+ return func
+
+ def setnewname(name):
+ def decorator(func):
+ func.__name__ = name
+ return func
+ return decorator
+
+ the descriptions should look like this::
+
+ .. py:decorator:: removename
+
+ Remove name of the decorated function.
+
+ .. py:decorator:: setnewname(name)
+
+ Set name of the decorated function to *name*.
+
+ (as opposed to ``.. py:decorator:: removename(func)``.)
+
+ There is no ``py:deco`` role to link to a decorator that is marked up with
+ this directive; rather, use the :rst:role:`py:func` role.
+
+ .. rst:directive:option:: single-line-parameter-list
+ :type: no value
+
+ Ensures that the decorator's arguments will be emitted on a single logical
+ line, overriding :confval:`python_maximum_signature_line_length` and
+ :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.1
+
+ .. rst:directive:option:: single-line-type-parameter-list
+ :type: no value
+
+ Ensure that the decorator's type parameters are emitted on a single
+ logical line, overriding :confval:`python_maximum_signature_line_length`
+ and :confval:`maximum_signature_line_length`.
+
+ .. versionadded:: 7.2
+
+.. rst:directive:: .. py:decoratormethod:: name
+ .. py:decoratormethod:: name(signature)
+ .. py:decoratormethod:: name[type parameters](signature)
+
+ Same as :rst:dir:`py:decorator`, but for decorators that are methods.
+
+ Refer to a decorator method using the :rst:role:`py:meth` role.
+
+.. _signatures:
+
+Python Signatures
+-----------------
+
+Signatures of functions, methods and class constructors can be given like they
+would be written in Python.
+
+Default values for optional arguments can be given (but if they contain commas,
+they will confuse the signature parser). Python 3-style argument annotations
+can also be given as well as return type annotations::
+
+ .. py:function:: compile(source : string, filename, symbol='file') -> ast object
+
+For functions with optional parameters that don't have default values
+(typically functions implemented in C extension modules without keyword
+argument support), you can use brackets to specify the optional parts:
+
+.. py:function:: compile(source[, filename[, symbol]])
+ :no-contents-entry:
+ :no-index-entry:
+
+It is customary to put the opening bracket before the comma.
+
+Python 3.12 introduced *type parameters*, which are type variables
+declared directly within the class or function definition:
+
+.. code-block:: python
+
+ class AnimalList[AnimalT](list[AnimalT]):
+ ...
+
+ def add[T](a: T, b: T) -> T:
+ return a + b
+
+The corresponding reStructuredText documentation would be:
+
+.. code-block:: rst
+
+ .. py:class:: AnimalList[AnimalT]
+
+ .. py:function:: add[T](a: T, b: T) -> T
+
+See :pep:`695` and :pep:`696` for details and the full specification.
+
+.. _info-field-lists:
+
+Info field lists
+----------------
+
+.. versionadded:: 0.4
+.. versionchanged:: 3.0
+
+ meta fields are added.
+
+Inside Python object description directives,
+reStructuredText field lists with these fields
+are recognized and formatted nicely:
+
+* ``param``, ``parameter``, ``arg``, ``argument``, ``key``, ``keyword``:
+ Description of a parameter.
+* ``type``: Type of a parameter. Creates a link if possible.
+* ``raises``, ``raise``, ``except``, ``exception``: That (and when) a specific
+ exception is raised.
+* ``var``, ``ivar``, ``cvar``: Description of a variable.
+* ``vartype``: Type of a variable. Creates a link if possible.
+* ``returns``, ``return``: Description of the return value.
+* ``rtype``: Return type. Creates a link if possible.
+* ``meta``: Add metadata to description of the python object. The metadata will
+ not be shown on output document. For example, ``:meta private:`` indicates
+ the python object is private member. It is used in
+ :py:mod:`sphinx.ext.autodoc` for filtering members.
+
+.. note::
+
+ In current release, all ``var``, ``ivar`` and ``cvar`` are represented as
+ "Variable". There is no difference at all.
+
+The field names must consist of one of these keywords and an argument (except
+for ``returns`` and ``rtype``, which do not need an argument). This is best
+explained by an example::
+
+ .. py:function:: send_message(sender, recipient, message_body, [priority=1])
+
+ Send a message to a recipient
+
+ :param str sender: The person sending the message
+ :param str recipient: The recipient of the message
+ :param str message_body: The body of the message
+ :param priority: The priority of the message, can be a number 1-5
+ :type priority: integer or None
+ :return: the message id
+ :rtype: int
+ :raises ValueError: if the message_body exceeds 160 characters
+ :raises TypeError: if the message_body is not a basestring
+
+This will render like this:
+
+.. py:function:: send_message(sender, recipient, message_body, [priority=1])
+ :no-contents-entry:
+ :no-index-entry:
+
+ Send a message to a recipient
+
+ :param str sender: The person sending the message
+ :param str recipient: The recipient of the message
+ :param str message_body: The body of the message
+ :param priority: The priority of the message, can be a number 1-5
+ :type priority: int or None
+ :return: the message id
+ :rtype: int
+ :raises ValueError: if the message_body exceeds 160 characters
+ :raises TypeError: if the message_body is not a basestring
+
+It is also possible to combine parameter type and description, if the type is a
+single word, like this::
+
+ :param int priority: The priority of the message, can be a number 1-5
+
+.. versionadded:: 1.5
+
+Container types such as lists and dictionaries can be linked automatically
+using the following syntax::
+
+ :type priorities: list(int)
+ :type priorities: list[int]
+ :type mapping: dict(str, int)
+ :type mapping: dict[str, int]
+ :type point: tuple(float, float)
+ :type point: tuple[float, float]
+
+Multiple types in a type field will be linked automatically if separated by the
+word "or"::
+
+ :type an_arg: int or None
+ :vartype a_var: str or int
+ :rtype: float or str
+
+.. _python-xref-roles:
+
+Cross-referencing Python objects
+--------------------------------
+
+The following roles refer to objects in modules and are possibly hyperlinked if
+a matching identifier is found:
+
+.. rst:role:: py:mod
+
+ Reference a module; a dotted name may be used. This should also be used for
+ package names.
+
+.. rst:role:: py:func
+
+ Reference a Python function; dotted names may be used. The role text needs
+ not include trailing parentheses to enhance readability; they will be added
+ automatically by Sphinx if the :confval:`add_function_parentheses` config
+ value is ``True`` (the default).
+
+.. rst:role:: py:data
+
+ Reference a module-level variable.
+
+.. rst:role:: py:const
+
+ Reference a "defined" constant. This may be a Python variable that is not
+ intended to be changed.
+
+.. rst:role:: py:class
+
+ Reference a class; a dotted name may be used.
+
+.. rst:role:: py:meth
+
+ Reference a method of an object. The role text can include the type name
+ and the method name; if it occurs within the description of a type, the type
+ name can be omitted. A dotted name may be used.
+
+.. rst:role:: py:attr
+
+ Reference a data attribute of an object.
+
+ .. note:: The role is also able to refer to property.
+
+.. rst:role:: py:type
+
+ Reference a type alias.
+
+.. rst:role:: py:exc
+
+ Reference an exception. A dotted name may be used.
+
+.. rst:role:: py:obj
+
+ Reference an object of unspecified type. Useful e.g. as the
+ :confval:`default_role`.
+
+ .. versionadded:: 0.4
+
+The name enclosed in this markup can include a module name and/or a class name.
+For example, ``:py:func:`filter``` could refer to a function named ``filter``
+in the current module, or the built-in function of that name. In contrast,
+``:py:func:`foo.filter``` clearly refers to the ``filter`` function in the
+``foo`` module.
+
+Normally, names in these roles are searched first without any further
+qualification, then with the current module name prepended, then with the
+current module and class name (if any) prepended. If you prefix the name with
+a dot, this order is reversed. For example, in the documentation of Python's
+:mod:`codecs` module, ``:py:func:`open``` always refers to the built-in
+function, while ``:py:func:`.open``` refers to :func:`codecs.open`.
+
+A similar heuristic is used to determine whether the name is an attribute of
+the currently documented class.
+
+Also, if the name is prefixed with a dot, and no exact match is found, the
+target is taken as a suffix and all object names with that suffix are searched.
+For example, ``:py:meth:`.TarFile.close``` references the
+``tarfile.TarFile.close()`` function, even if the current module is not
+``tarfile``. Since this can get ambiguous, if there is more than one possible
+match, you will get a warning from Sphinx.
+
+Note that you can combine the ``~`` and ``.`` prefixes:
+``:py:meth:`~.TarFile.close``` will reference the ``tarfile.TarFile.close()``
+method, but the visible link caption will only be ``close()``.
diff --git a/doc/usage/domains/restructuredtext.rst b/doc/usage/domains/restructuredtext.rst
new file mode 100644
index 0000000..639b686
--- /dev/null
+++ b/doc/usage/domains/restructuredtext.rst
@@ -0,0 +1,100 @@
+.. highlight:: rst
+
+===========================
+The reStructuredText Domain
+===========================
+
+.. versionadded:: 1.0
+
+The reStructuredText domain (name **rst**) provides the following directives:
+
+.. rst:directive:: .. rst:directive:: name
+
+ Describes a reStructuredText directive.
+ The *name* can be a single directive name or actual directive syntax
+ (`..` prefix and `::` suffix) with arguments that will be rendered differently.
+ For example::
+
+ .. rst:directive:: foo
+
+ Foo description.
+
+ .. rst:directive:: .. bar:: baz
+
+ Bar description.
+
+ will be rendered as:
+
+ .. rst:directive:: foo
+ :no-contents-entry:
+ :no-index-entry:
+
+ Foo description.
+
+ .. rst:directive:: .. bar:: baz
+ :no-contents-entry:
+ :no-index-entry:
+
+ Bar description.
+
+.. rst:directive:: .. rst:directive:option:: name
+
+ Describes an option for reStructuredText directive. The *name* can be a single option
+ name or option name with arguments which separated with colon (``:``).
+ For example::
+
+ .. rst:directive:: toctree
+
+ .. rst:directive:option:: caption: caption of ToC
+
+ .. rst:directive:option:: glob
+
+ will be rendered as:
+
+ .. rst:directive:: toctree
+ :no-index:
+
+ .. rst:directive:option:: caption: caption of ToC
+ :no-index:
+
+ .. rst:directive:option:: glob
+ :no-index:
+
+ .. rubric:: options
+
+ .. rst:directive:option:: type: description of argument
+ :type: text
+
+ Describe the type of option value.
+
+ For example::
+
+ .. rst:directive:: toctree
+
+ .. rst:directive:option:: maxdepth
+ :type: integer or no value
+
+ .. versionadded:: 2.1
+
+.. rst:directive:: .. rst:role:: name
+
+ Describes a reStructuredText role. For example::
+
+ .. rst:role:: foo
+
+ Foo description.
+
+ will be rendered as:
+
+ .. rst:role:: foo
+ :no-contents-entry:
+ :no-index-entry:
+
+ Foo description.
+
+.. _rst-xref-roles:
+
+These roles are provided to refer to the described objects:
+
+.. rst:role:: rst:dir
+ rst:role
diff --git a/doc/usage/domains/standard.rst b/doc/usage/domains/standard.rst
new file mode 100644
index 0000000..a676a2d
--- /dev/null
+++ b/doc/usage/domains/standard.rst
@@ -0,0 +1,133 @@
+.. highlight:: rst
+
+===================
+The Standard Domain
+===================
+
+.. versionadded:: 1.0
+
+The so-called "standard" domain collects all markup that doesn't warrant a
+domain of its own. Its directives and roles are not prefixed with a domain
+name.
+
+The standard domain is also where custom object descriptions, added using the
+:func:`~sphinx.application.Sphinx.add_object_type` API, are placed.
+
+There is a set of directives allowing documenting command-line programs:
+
+.. rst:directive:: .. option:: name args, name args, ...
+
+ Describes a command line argument or switch. Option argument names should
+ be enclosed in angle brackets. Examples::
+
+ .. option:: dest_dir
+
+ Destination directory.
+
+ .. option:: -m <module>, --module <module>
+
+ Run a module as a script.
+
+ The directive will create cross-reference targets for the given options,
+ referenceable by :rst:role:`option` (in the example case, you'd use something
+ like ``:option:`dest_dir```, ``:option:`-m```, or ``:option:`--module```).
+
+ .. versionchanged:: 5.3
+
+ One can cross-reference including an option value: ``:option:`--module=foobar```,
+ ,``:option:`--module[=foobar]``` or ``:option:`--module foobar```.
+
+ Use :confval:`option_emphasise_placeholders` for parsing of
+ "variable part" of a literal text (similarly to the :rst:role:`samp` role).
+
+ ``cmdoption`` directive is a deprecated alias for the ``option`` directive.
+
+.. rst:directive:: .. confval:: name
+
+ Describes a configuration value or setting that the documented
+ code or program uses or defines.
+ Referenceable by :rst:role:`confval`.
+
+ .. rst:directive:option:: type
+ :type: text
+
+ Describes the type of the configuration value.
+ This is optional, and if specified will be interpreted as reStructuredText.
+
+ .. rst:directive:option:: default
+ :type: text
+
+ Describes the default value of the configuration value.
+ This is optional, and if specified will be interpreted as reStructuredText.
+
+ Example:
+
+ .. code-block:: rst
+
+ .. confval:: the_answer
+ :type: ``int`` (a *number*)
+ :default: **42**
+
+ This is a setting that controls the value of the answer.
+
+ will be rendered as follows:
+
+ .. confval:: the_answer
+ :no-contents-entry:
+ :no-index-entry:
+ :type: ``int`` (a *number*)
+ :default: **42**
+
+ This is a setting that controls the value of the answer.
+
+.. rst:directive:: .. envvar:: name
+
+ Describes an environment variable that the documented code or program uses
+ or defines. Referenceable by :rst:role:`envvar`.
+
+.. rst:directive:: .. program:: name
+
+ Like :rst:dir:`py:currentmodule`, this directive produces no output.
+ Instead, it serves to notify Sphinx that all following :rst:dir:`option`
+ directives document options for the program called *name*.
+
+ If you use :rst:dir:`program`, you have to qualify the references in your
+ :rst:role:`option` roles by the program name, so if you have the following
+ situation ::
+
+ .. program:: rm
+
+ .. option:: -r
+
+ Work recursively.
+
+ .. program:: svn
+
+ .. option:: -r <revision>
+
+ Specify the revision to work upon.
+
+ then ``:option:`rm -r``` would refer to the first option, while
+ ``:option:`svn -r``` would refer to the second one.
+
+ If ``None`` is passed to the argument, the directive will reset the
+ current program name.
+
+ The program name may contain spaces (in case you want to document
+ subcommands like ``svn add`` and ``svn commit`` separately).
+
+ .. versionadded:: 0.5
+
+There is also a very generic object description directive, which is not tied to
+any domain:
+
+.. rst:directive:: .. describe:: text
+ .. object:: text
+
+ This directive produces the same formatting as the specific ones provided by
+ domains, but does not create index entries or cross-referencing targets.
+ Example::
+
+ .. describe:: PAPER
+
+ You can set this variable to select a paper size.
diff --git a/doc/usage/extensions/autodoc.rst b/doc/usage/extensions/autodoc.rst
index 1498ae9..a2a093f 100644
--- a/doc/usage/extensions/autodoc.rst
+++ b/doc/usage/extensions/autodoc.rst
@@ -1,4 +1,6 @@
-.. highlight:: rest
+.. highlight:: rst
+
+.. _ext-autodoc:
:mod:`sphinx.ext.autodoc` -- Include documentation from docstrings
==================================================================
@@ -12,13 +14,6 @@
This extension can import the modules you are documenting, and pull in
documentation from docstrings in a semi-automatic way.
-.. note::
-
- For Sphinx (actually, the Python interpreter that executes Sphinx) to find
- your module, it must be importable. That means that the module or the
- package must be in one of the directories on :data:`sys.path` -- adapt your
- :data:`sys.path` in the configuration file accordingly.
-
.. warning::
:mod:`~sphinx.ext.autodoc` **imports** the modules to be documented. If any
@@ -40,9 +35,71 @@ you can also enable the :mod:`napoleon <sphinx.ext.napoleon>` extension.
:mod:`napoleon <sphinx.ext.napoleon>` is a preprocessor that converts your
docstrings to correct reStructuredText before :mod:`autodoc` processes them.
-.. _Google: https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings
+.. _Google: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings
.. _NumPy: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
+Getting started
+---------------
+
+Setup
+.....
+Activate the plugin by adding ``'sphinx.ext.autodoc'`` to the :confval:`extensions`
+in your :file:`conf.py`::
+
+ extensions = [
+ ...
+ 'sphinx.ext.autodoc',
+ ]
+
+Ensuring the code can be imported
+.................................
+
+:mod:`~sphinx.ext.autodoc` analyses the code and docstrings by introspection after
+importing the modules. For importing to work, you have to make sure that your
+modules can be found by Sphinx and that dependencies can be resolved (if your
+module does ``import foo``, but ``foo`` is not available in the python environment
+that Sphinx runs in, your module import will fail).
+
+There are two ways to ensure this:
+
+1. Use an environment that contains your package and Sphinx. This can e.g. be your
+ local dev environment (with an editable install), or an environment in CI in
+ which you install Sphinx and your package. The regular installation process
+ ensures that your package can be found by Sphinx and that all dependencies are
+ available.
+
+2. It is alternatively possible to patch the Sphinx run so that it can operate
+ directly on the sources; e.g. if you want to be able to do a Sphinx build from a
+ source checkout.
+
+ - Patch :data:`sys.path` in your Sphinx :file:`conf.py` to include the folder of
+ your sources. E.g. if you have a repository structure with :file:`doc/conf.py`
+ and your package is at :file:`src/mypackage`, then you should add::
+
+ sys.path.insert(0, os.path.abspath('../src'))
+
+ to your :file:`conf.py`.
+
+ - To cope with missing dependencies, specify the missing modules in
+ :confval:`autodoc_mock_imports`.
+
+Usage
+.....
+
+You can now use the :ref:`autodoc-directives` to add formatted documentation for
+Python code elements like functions, classes, modules, etc. For example, to document
+the function ``io.open()``, reading its signature and docstring from the source file,
+you'd write ::
+
+ .. autofunction:: io.open
+
+You can also document whole classes or even modules automatically, using member
+options for the auto directives, like ::
+
+ .. automodule:: io
+ :members:
+
+.. _autodoc-directives:
Directives
----------
@@ -271,7 +328,7 @@ inserting them into the page source under a suitable :rst:dir:`py:module`,
once by specifying the option to :rst:dir:`automodule` directive.
Note: this will lead to markup errors if the inherited members come from a
- module whose docstrings are not reST formatted.
+ module whose docstrings are not reStructuredText formatted.
.. versionadded:: 0.3
@@ -688,7 +745,7 @@ There are also config values that you can set:
* ``'fully-qualified'`` -- Show the module name and its name of typehints
* ``'short'`` -- Suppress the leading module names of the typehints
- (ex. ``io.StringIO`` -> ``StringIO``) (default)
+ (e.g. ``io.StringIO`` -> ``StringIO``) (default)
.. versionadded:: 4.4
@@ -816,8 +873,8 @@ needed docstring processing in event :event:`autodoc-process-docstring`:
.. versionadded:: 4.1
.. versionchanged:: 4.3
- ``bases`` can contain a string as a base class name. It will be processed
- as reST mark-up'ed text.
+ ``bases`` can contain a string as a base class name.
+ It will be processed as reStructuredText.
Skipping members
diff --git a/doc/usage/extensions/autosectionlabel.rst b/doc/usage/extensions/autosectionlabel.rst
index b5b9b51..29b1c2a 100644
--- a/doc/usage/extensions/autosectionlabel.rst
+++ b/doc/usage/extensions/autosectionlabel.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.autosectionlabel` -- Allow reference sections using its title
==============================================================================
@@ -51,6 +51,6 @@ Debugging
---------
The ``WARNING: undefined label`` indicates that your reference in
-:rst:role:`ref` is mis-spelled. Invoking :program:`sphinx-build` with ``-vv``
+:rst:role:`ref` is mis-spelled. Invoking :program:`sphinx-build` with ``-vvv``
(see :option:`-v`) will print all section names and the labels that have been
generated for them. This output can help finding the right reference label.
diff --git a/doc/usage/extensions/autosummary.rst b/doc/usage/extensions/autosummary.rst
index a18460b..0a25d8d 100644
--- a/doc/usage/extensions/autosummary.rst
+++ b/doc/usage/extensions/autosummary.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.autosummary` -- Generate autodoc summaries
===========================================================
diff --git a/doc/usage/extensions/coverage.rst b/doc/usage/extensions/coverage.rst
index 1390ebf..75ffc0f 100644
--- a/doc/usage/extensions/coverage.rst
+++ b/doc/usage/extensions/coverage.rst
@@ -6,15 +6,64 @@
This extension features one additional builder, the :class:`CoverageBuilder`.
-.. class:: CoverageBuilder
+.. todo:: Write this section.
- To use this builder, activate the coverage extension in your configuration
- file and give ``-b coverage`` on the command line.
+.. note::
-.. todo:: Write this section.
+ The :doc:`sphinx-apidoc </man/sphinx-apidoc>` command can be used to
+ automatically generate API documentation for all code in a project,
+ avoiding the need to manually author these documents and keep them up-to-date.
+
+.. warning::
+
+ :mod:`~sphinx.ext.coverage` **imports** the modules to be documented.
+ If any modules have side effects on import,
+ these will be executed by the coverage builder when ``sphinx-build`` is run.
+
+ If you document scripts (as opposed to library modules),
+ make sure their main routine is protected by a
+ ``if __name__ == '__main__'`` condition.
+
+.. note::
+
+ For Sphinx (actually, the Python interpreter that executes Sphinx)
+ to find your module, it must be importable.
+ That means that the module or the package must be in
+ one of the directories on :data:`sys.path` -- adapt your :data:`sys.path`
+ in the configuration file accordingly.
+
+To use this builder, activate the coverage extension in your configuration file
+and run ``sphinx-build -M coverage`` on the command line.
+
+
+Builder
+-------
+
+.. py:class:: CoverageBuilder
+
+
+Configuration
+-------------
+
+Several configuration values can be used to specify
+what the builder should check:
+
+.. confval:: coverage_modules
+ :type: ``list[str]``
+ :default: ``[]``
+
+ List of Python packages or modules to test coverage for.
+ When this is provided, Sphinx will introspect each package
+ or module provided in this list as well
+ as all sub-packages and sub-modules found in each.
+ When this is not provided, Sphinx will only provide coverage
+ for Python packages and modules that it is aware of:
+ that is, any modules documented using the :rst:dir:`py:module` directive
+ provided in the :doc:`Python domain </usage/domains/python>`
+ or the :rst:dir:`automodule` directive provided by the
+ :mod:`~sphinx.ext.autodoc` extension.
-Several configuration values can be used to specify what the builder
-should check:
+ .. versionadded:: 7.4
.. confval:: coverage_ignore_modules
@@ -62,7 +111,7 @@ should check:
.. confval:: coverage_statistics_to_report
- Print a tabluar report of the coverage statistics to the coverage report.
+ Print a tabular report of the coverage statistics to the coverage report.
``True`` by default.
Example output:
@@ -81,7 +130,7 @@ should check:
.. confval:: coverage_statistics_to_stdout
- Print a tabluar report of the coverage statistics to standard output.
+ Print a tabular report of the coverage statistics to standard output.
``False`` by default.
Example output:
diff --git a/doc/usage/extensions/doctest.rst b/doc/usage/extensions/doctest.rst
index 1848e1f..a5fc2c7 100644
--- a/doc/usage/extensions/doctest.rst
+++ b/doc/usage/extensions/doctest.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.doctest` -- Test snippets in the documentation
===============================================================
@@ -344,12 +344,12 @@ The doctest extension uses the following configuration values:
.. confval:: doctest_test_doctest_blocks
- If this is a nonempty string (the default is ``'default'``), standard reST
- doctest blocks will be tested too. They will be assigned to the group name
- given.
+ If this is a nonempty string (the default is ``'default'``),
+ standard reStructuredText doctest blocks will be tested too.
+ They will be assigned to the group name given.
- reST doctest blocks are simply doctests put into a paragraph of their own,
- like so::
+ reStructuredText doctest blocks are simply doctests
+ put into a paragraph of their own, like so::
Some documentation text.
@@ -378,8 +378,8 @@ The doctest extension uses the following configuration values:
with the :mod:`~sphinx.ext.autodoc` extension without marking them up with a
special directive.
- Note though that you can't have blank lines in reST doctest blocks. They
- will be interpreted as one block ending and another one starting. Also,
- removal of ``<BLANKLINE>`` and ``# doctest:`` options only works in
+ Note though that you can't have blank lines in reStructuredText doctest blocks.
+ They will be interpreted as one block ending and another one starting.
+ Also, removal of ``<BLANKLINE>`` and ``# doctest:`` options only works in
:rst:dir:`doctest` blocks, though you may set :confval:`trim_doctest_flags`
to achieve that in all code blocks with Python console content.
diff --git a/doc/usage/extensions/example_google.py b/doc/usage/extensions/example_google.py
index 434fa3b..7cd24d1 100644
--- a/doc/usage/extensions/example_google.py
+++ b/doc/usage/extensions/example_google.py
@@ -290,6 +290,7 @@ class ExampleClass:
def _private_without_docstring(self):
pass
+
class ExamplePEP526Class:
"""The summary line for a class docstring should fit on one line.
diff --git a/doc/usage/extensions/example_numpy.py b/doc/usage/extensions/example_numpy.py
index 2346b1e..d258ca3 100644
--- a/doc/usage/extensions/example_numpy.py
+++ b/doc/usage/extensions/example_numpy.py
@@ -266,7 +266,7 @@ class ExampleClass:
self.attr3 = param3 #: Doc comment *inline* with attribute
#: list(str): Doc comment *before* attribute, with type specified
- self.attr4 = ["attr4"]
+ self.attr4 = ['attr4']
self.attr5 = None
"""str: Docstring *after* attribute, with type specified."""
@@ -274,7 +274,7 @@ class ExampleClass:
@property
def readonly_property(self):
"""str: Properties should be documented in their getter method."""
- return "readonly_property"
+ return 'readonly_property'
@property
def readwrite_property(self):
@@ -284,7 +284,7 @@ class ExampleClass:
If the setter method contains notable behavior, it should be
mentioned here.
"""
- return ["readwrite_property"]
+ return ['readwrite_property']
@readwrite_property.setter
def readwrite_property(self, value):
diff --git a/doc/usage/extensions/graphviz.rst b/doc/usage/extensions/graphviz.rst
index c134f6d..0cd7cac 100644
--- a/doc/usage/extensions/graphviz.rst
+++ b/doc/usage/extensions/graphviz.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.graphviz` -- Add Graphviz graphs
=================================================
@@ -66,7 +66,7 @@ It adds these directives:
.. rst:directive:option:: layout: layout type of the graph
:type: text
- The layout of the graph (ex. ``dot``, ``neato`` and so on). A path to the
+ The layout of the graph (e.g. ``dot``, ``neato`` and so on). A path to the
graphviz commands are also allowed. By default, :confval:`graphviz_dot`
is used.
@@ -211,7 +211,7 @@ There are also these config values:
:program:`sphinx-build` command line via the :option:`-D <sphinx-build -D>`
option should be preferable, like this::
- sphinx-build -b html -D graphviz_dot=C:\graphviz\bin\dot.exe . _build/html
+ sphinx-build -M html -D graphviz_dot=C:\graphviz\bin\dot.exe . _build
.. confval:: graphviz_dot_args
diff --git a/doc/usage/extensions/ifconfig.rst b/doc/usage/extensions/ifconfig.rst
index 837c0b3..17cdbc0 100644
--- a/doc/usage/extensions/ifconfig.rst
+++ b/doc/usage/extensions/ifconfig.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.ifconfig` -- Include content based on configuration
====================================================================
diff --git a/doc/usage/extensions/inheritance.rst b/doc/usage/extensions/inheritance.rst
index 33284b5..90bbcc3 100644
--- a/doc/usage/extensions/inheritance.rst
+++ b/doc/usage/extensions/inheritance.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
:mod:`sphinx.ext.inheritance_diagram` -- Include inheritance diagrams
=====================================================================
diff --git a/doc/usage/extensions/intersphinx.rst b/doc/usage/extensions/intersphinx.rst
index 5aaaf9f..f64b596 100644
--- a/doc/usage/extensions/intersphinx.rst
+++ b/doc/usage/extensions/intersphinx.rst
@@ -1,3 +1,5 @@
+.. _ext-intersphinx:
+
:mod:`sphinx.ext.intersphinx` -- Link to other projects' documentation
======================================================================
@@ -143,7 +145,7 @@ linking:
Example:
- .. code:: python
+ .. code-block:: python
intersphinx_mapping = {'https://docs.python.org/': None}
@@ -218,6 +220,7 @@ The Intersphinx extension provides the following role.
e.g., ``:external:py:class:`zipfile.ZipFile```, or
- ``:external:reftype:`target```,
e.g., ``:external:doc:`installation```.
+ With this shorthand, the domain is assumed to be ``std``.
If you would like to constrain the lookup to a specific external project,
then the key of the project, as specified in :confval:`intersphinx_mapping`,
diff --git a/doc/usage/extensions/math.rst b/doc/usage/extensions/math.rst
index df4fc6b..7d48d3a 100644
--- a/doc/usage/extensions/math.rst
+++ b/doc/usage/extensions/math.rst
@@ -1,4 +1,4 @@
-.. highlight:: rest
+.. highlight:: rst
.. _math-support:
@@ -75,7 +75,7 @@ are built:
:program:`sphinx-build` command line via the :option:`-D <sphinx-build -D>`
option should be preferable, like this::
- sphinx-build -b html -D imgmath_latex=C:\tex\latex.exe . _build/html
+ sphinx-build -M html -D imgmath_latex=C:\tex\latex.exe . _build
This value should only contain the path to the latex executable, not further
arguments; use :confval:`imgmath_latex_args` for that purpose.
@@ -316,5 +316,5 @@ package jsMath_. It provides this config value:
.. _dvisvgm: https://dvisvgm.de/
.. _dvisvgm FAQ: https://dvisvgm.de/FAQ
.. _MathJax: https://www.mathjax.org/
-.. _jsMath: http://www.math.union.edu/~dpvc/jsmath/
+.. _jsMath: https://www.math.union.edu/~dpvc/jsmath/
.. _LaTeX preview package: https://www.gnu.org/software/auctex/preview-latex.html
diff --git a/doc/usage/extensions/napoleon.rst b/doc/usage/extensions/napoleon.rst
index d2391da..4b077de 100644
--- a/doc/usage/extensions/napoleon.rst
+++ b/doc/usage/extensions/napoleon.rst
@@ -63,14 +63,14 @@ Getting Started
~~~~~~~~~~~~~~~
1. After :doc:`setting up Sphinx </usage/quickstart>` to build your docs,
- enable napoleon in the Sphinx `conf.py` file::
+ enable napoleon in the Sphinx ``conf.py`` file::
# conf.py
# Add napoleon to the extensions list
extensions = ['sphinx.ext.napoleon']
-2. Use `sphinx-apidoc` to build your API documentation::
+2. Use ``sphinx-apidoc`` to build your API documentation::
$ sphinx-apidoc -f -o docs/source projectdir
@@ -271,8 +271,8 @@ Configuration
-------------
Listed below are all the settings used by napoleon and their default
-values. These settings can be changed in the Sphinx `conf.py` file. Make
-sure that "sphinx.ext.napoleon" is enabled in `conf.py`::
+values. These settings can be changed in the Sphinx ``conf.py`` file. Make
+sure that "sphinx.ext.napoleon" is enabled in ``conf.py``::
# conf.py
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index fd8cdd8..167c7aa 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -12,8 +12,10 @@ looking for guidance on extending Sphinx, refer to :doc:`/development/index`.
restructuredtext/index
markdown
+ referencing
configuration
builders/index
+ domains/index
extensions/index
theming
advanced/intl
diff --git a/doc/usage/installation.rst b/doc/usage/installation.rst
index e85603e..7be6889 100644
--- a/doc/usage/installation.rst
+++ b/doc/usage/installation.rst
@@ -2,30 +2,101 @@
Installing Sphinx
=================
-.. contents::
- :depth: 1
+Sphinx is a Python application. It can be installed in one of the ways described
+below.
+
+.. contents:: Installation methods
+ :depth: 2
:local:
:backlinks: none
.. highlight:: console
-Overview
---------
+After installation, you can check that Sphinx is available by running ::
+
+ $ sphinx-build --version
+
+This should print out the Sphinx version number.
+
+
+.. tip::
+
+ For local development, it is
+ generally recommended to install Sphinx into a non-global environment
+ (using for example `venv`__ or `conda`__ environments).
+ This will allow for the use of separate sphinx versions and third-party extensions
+ for each sphinx project.
+
+ __ https://docs.python.org/3/library/venv.html
+ __ https://conda.io/projects/conda/en/latest/user-guide/getting-started.html
+
+
+.. _install-pypi:
+
+PyPI package
+------------
+
+Sphinx packages are published on the `Python Package Index
+<https://pypi.org/project/Sphinx/>`_ (PyPI). The preferred tool for installing
+packages from PyPI is :command:`pip`, which is included in all modern versions of
+Python.
+
+Run the following command::
+
+ $ pip install -U sphinx
+
+.. tip::
+
+ To avoid issues when rebuilding your environment,
+ it is advisable to pin sphinx and third-party extension
+ versions in a `requirements.txt file`__::
+
+ $ pip install -r requirements.txt
+
+ Or, if writing documentation for a Python package,
+ place the dependencies in the `pyproject.toml file`__::
+
+ $ pip install .[docs]
-Sphinx is written in `Python`__ and supports Python 3.9+. It builds upon the
-shoulders of many third-party libraries such as `Docutils`__ and `Jinja`__,
-which are installed when Sphinx is installed.
+ __ https://pip.pypa.io/en/stable/reference/requirements-file-format/
+ __ https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#dependencies-optional-dependencies
-__ https://docs.python-guide.org/
-__ https://docutils.sourceforge.io/
-__ https://jinja.palletsprojects.com/
+.. _install-conda:
+Conda package
+-------------
+To work with :command:`conda`, you need a conda-based Python distribution such as
+`anaconda`__, `miniconda`__, `miniforge`__ or `micromamba`__.
+
+__ https://docs.anaconda.com/anaconda/
+__ https://docs.anaconda.com/miniconda/
+__ https://github.com/conda-forge/miniforge/
+__ https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html
+
+
+Sphinx is available both via the *anaconda main* channel (maintained by Anaconda
+Inc.)
+
+::
+
+ $ conda install sphinx
+
+as well as via the *conda-forge* community channel ::
+
+ $ conda install -c conda-forge sphinx
+
+OS-specific package manager
+---------------------------
+
+You may install a global version of Sphinx into your system using OS-specific
+package managers. However, be aware that this is less flexible and you may run into
+compatibility issues if you want to work across different projects.
Linux
------
+~~~~~
Debian/Ubuntu
-~~~~~~~~~~~~~
+"""""""""""""
Install either ``python3-sphinx`` using :command:`apt-get`:
@@ -36,7 +107,7 @@ Install either ``python3-sphinx`` using :command:`apt-get`:
If it not already present, this will install Python for you.
RHEL, CentOS
-~~~~~~~~~~~~
+""""""""""""
Install ``python-sphinx`` using :command:`yum`:
@@ -47,7 +118,7 @@ Install ``python-sphinx`` using :command:`yum`:
If it not already present, this will install Python for you.
Other distributions
-~~~~~~~~~~~~~~~~~~~
+"""""""""""""""""""
Most Linux distributions have Sphinx in their package repositories. Usually
the package is called ``python3-sphinx``, ``python-sphinx`` or ``sphinx``. Be
@@ -55,19 +126,16 @@ aware that there are at least two other packages with ``sphinx`` in their name:
a speech recognition toolkit (*CMU Sphinx*) and a full-text search database
(*Sphinx search*).
-
macOS
------
+~~~~~
-Sphinx can be installed using `Homebrew`__, `MacPorts`__, or as part of
-a Python distribution such as `Anaconda`__.
+Sphinx can be installed using `Homebrew`__, `MacPorts`__.
__ https://brew.sh/
__ https://www.macports.org/
-__ https://www.anaconda.com/download/#macos
Homebrew
-~~~~~~~~
+""""""""
::
@@ -78,7 +146,7 @@ For more information, refer to the `package overview`__.
__ https://formulae.brew.sh/formula/sphinx-doc
MacPorts
-~~~~~~~~
+""""""""
Install either ``python3x-sphinx`` using :command:`port`:
@@ -97,23 +165,15 @@ For more information, refer to the `package overview`__.
__ https://www.macports.org/ports.php?by=library&substr=py39-sphinx
-Anaconda
-~~~~~~~~
-
-::
-
- $ conda install sphinx
-
Windows
--------
+~~~~~~~
-Sphinx can be install using `Chocolatey`__ or
-:ref:`installed manually <windows-other-method>`.
+Sphinx can be install using `Chocolatey`__.
__ https://chocolatey.org/
Chocolatey
-~~~~~~~~~~
+""""""""""
::
@@ -127,91 +187,6 @@ For more information, refer to the `chocolatey page`__.
__ https://chocolatey.org/packages/sphinx/
-.. _windows-other-method:
-
-Other Methods
-~~~~~~~~~~~~~
-
-Most Windows users do not have Python installed by default, so we begin with
-the installation of Python itself. To check if you already have Python
-installed, open the *Command Prompt* (:kbd:`⊞Win-r` and type :command:`cmd`).
-Once the command prompt is open, type :command:`python --version` and press
-Enter. If Python is installed, you will see the version of Python printed to
-the screen. If you do not have Python installed, refer to the `Hitchhikers
-Guide to Python's`__ Python on Windows installation guides. You must install
-`Python 3`__.
-
-Once Python is installed, you can install Sphinx using :command:`pip`. Refer
-to the :ref:`pip installation instructions <install-pypi>` below for more
-information.
-
-__ https://docs.python-guide.org/
-__ https://docs.python-guide.org/starting/install3/win/
-
-
-.. _install-pypi:
-
-Installation from PyPI
-----------------------
-
-Sphinx packages are published on the `Python Package Index
-<https://pypi.org/project/Sphinx/>`_. The preferred tool for installing
-packages from *PyPI* is :command:`pip`. This tool is provided with all modern
-versions of Python.
-
-On Linux or MacOS, you should open your terminal and run the following command.
-
-::
-
- $ pip install -U sphinx
-
-On Windows, you should open *Command Prompt* (:kbd:`⊞Win-r` and type
-:command:`cmd`) and run the same command.
-
-.. code-block:: doscon
-
- C:\> pip install -U sphinx
-
-After installation, type :command:`sphinx-build --version` on the command
-prompt. If everything worked fine, you will see the version number for the
-Sphinx package you just installed.
-
-Installation from *PyPI* also allows you to install the latest development
-release. You will not generally need (or want) to do this, but it can be
-useful if you see a possible bug in the latest stable release. To do this, use
-the ``--pre`` flag.
-
-::
-
- $ pip install -U --pre sphinx
-
-Using virtual environments
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When installing Sphinx using pip,
-it is highly recommended to use *virtual environments*,
-which isolate the installed packages from the system packages,
-thus removing the need to use administrator privileges.
-To create a virtual environment in the ``.venv`` directory,
-use the following command.
-
-::
-
- $ python -m venv .venv
-
-You can read more about them in the `Python Packaging User Guide`_.
-
-.. _Python Packaging User Guide: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment
-
-.. warning::
-
- Note that in some Linux distributions, such as Debian and Ubuntu,
- this might require an extra installation step as follows.
-
- .. code-block:: console
-
- $ apt-get install python3-venv
-
Docker
------
@@ -253,6 +228,17 @@ For more details, please read `README file`__ of docker images.
.. __: https://hub.docker.com/r/sphinxdoc/sphinx
+Installation of the latest development release
+----------------------------------------------
+
+You can install the latest development from *PyPI* using the ``--pre`` flag::
+
+ $ pip install -U --pre sphinx
+
+.. warning::
+
+ You will not generally need (or want) to do this, but it can be
+ useful if you see a possible bug in the latest stable release.
Installation from source
------------------------
diff --git a/doc/usage/quickstart.rst b/doc/usage/quickstart.rst
index 0773f60..774a581 100644
--- a/doc/usage/quickstart.rst
+++ b/doc/usage/quickstart.rst
@@ -18,7 +18,7 @@ its :doc:`significant extensibility capabilities </development/index>`.
The goal of this document is to give you a quick taste of what Sphinx is and
how you might use it. When you're done here, you can check out the
:doc:`installation guide </usage/installation>` followed by the intro to the
-default markup format used by Sphinx, :doc:`reStucturedText
+default markup format used by Sphinx, :doc:`reStructuredText
</usage/restructuredtext/index>`.
For a great "introduction" to writing docs in general -- the whys and hows, see
@@ -54,7 +54,8 @@ to contain the root of the "table of contents tree" (or *toctree*). This is one
of the main things that Sphinx adds to reStructuredText, a way to connect
multiple files to a single hierarchy of documents.
-.. sidebar:: reStructuredText directives
+.. admonition:: reStructuredText directives
+ :class: note
``toctree`` is a reStructuredText :dfn:`directive`, a very versatile piece
of markup. Directives can have arguments, options and content.
@@ -95,7 +96,9 @@ documents to include are given as :term:`document name`\ s, which in short
means that you leave off the file name extension and use forward slashes
(``/``) as directory separators.
-|more| Read more about :ref:`the toctree directive <toctree-directive>`.
+.. seealso::
+
+ Read more about :ref:`the toctree directive <toctree-directive>`.
You can now create the files you listed in the ``toctree`` and add content, and
their section titles will be inserted (up to the ``maxdepth`` level) at the
@@ -118,8 +121,11 @@ for this document -- use the "Show Source" link in the sidebar.
.. todo:: Update the below link when we add new guides on these.
-|more| See :doc:`/usage/restructuredtext/index` for a more in-depth
-introduction to reStructuredText, including markup added by Sphinx.
+.. seealso::
+
+ :doc:`/usage/restructuredtext/index`
+ for a more in-depth introduction to reStructuredText,
+ including markup added by Sphinx.
Running the build
@@ -130,15 +136,17 @@ docs. A build is started with the :program:`sphinx-build` program:
.. code-block:: console
- $ sphinx-build -b html sourcedir builddir
+ $ sphinx-build -M html sourcedir outputdir
-where *sourcedir* is the :term:`source directory`, and *builddir* is the
+where *sourcedir* is the :term:`source directory`, and *outputdir* is the
directory in which you want to place the built documentation.
-The :option:`-b <sphinx-build -b>` option selects a builder; in this example
+The :option:`-M <sphinx-build -M>` option selects a builder; in this example
Sphinx will build HTML files.
-|more| Refer to the :doc:`sphinx-build man page </man/sphinx-build>` for all
-options that :program:`sphinx-build` supports.
+.. seealso::
+
+ Refer to the :doc:`sphinx-build man page </man/sphinx-build>`
+ for all options that :program:`sphinx-build` supports.
However, :program:`sphinx-quickstart` script creates a :file:`Makefile` and a
:file:`make.bat` which make life even easier for you. These can be executed by
@@ -220,8 +228,10 @@ Each domain will have special rules for how the signatures can look like, and
make the formatted output look pretty, or add specific features like links to
parameter types, e.g. in the C/C++ domains.
-|more| See :doc:`/usage/restructuredtext/domains` for all the available domains
-and their directives/roles.
+.. seealso::
+
+ :doc:`/usage/domains/index`
+ for all the available domains and their directives/roles.
Basic configuration
@@ -245,8 +255,10 @@ Keep in mind that the file uses Python syntax for strings, numbers, lists and
so on. The file is saved in UTF-8 by default, as indicated by the encoding
declaration in the first line.
-|more| See :doc:`/usage/configuration` for documentation of all available
-config values.
+.. seealso::
+
+ :doc:`/usage/configuration`
+ for documentation of all available config values.
.. todo:: Move this entire doc to a different section
@@ -259,42 +271,10 @@ source files, in documentation strings. Sphinx supports the inclusion of
docstrings from your modules with an :dfn:`extension` (an extension is a Python
module that provides additional features for Sphinx projects) called *autodoc*.
-In order to use *autodoc*, you need to activate it in :file:`conf.py` by
-putting the string ``'sphinx.ext.autodoc'`` into the list assigned to the
-:confval:`extensions` config value::
-
- extensions = ['sphinx.ext.autodoc']
-
-Then, you have a few additional directives at your disposal. For example, to
-document the function ``io.open()``, reading its signature and
-docstring from the source file, you'd write this::
-
- .. autofunction:: io.open
-
-You can also document whole classes or even modules automatically, using member
-options for the auto directives, like ::
+.. seealso::
- .. automodule:: io
- :members:
-
-*autodoc* needs to import your modules in order to extract the docstrings.
-Therefore, you must add the appropriate path to :py:data:`sys.path` in your
-:file:`conf.py`.
-
-.. warning::
-
- :mod:`~sphinx.ext.autodoc` **imports** the modules to be documented. If any
- modules have side effects on import, these will be executed by ``autodoc``
- when ``sphinx-build`` is run.
-
- If you document scripts (as opposed to library modules), make sure their
- main routine is protected by a ``if __name__ == '__main__'`` condition.
-
-|more| See :mod:`sphinx.ext.autodoc` for the complete description of the
-features of autodoc.
-
-
-.. todo:: Move this doc to another section
+ :mod:`sphinx.ext.autodoc`
+ for the complete description of the features of autodoc.
Intersphinx
-----------
@@ -322,8 +302,10 @@ download the list of valid targets). Intersphinx also works for some other
:term:`domain`\'s roles including ``:ref:``, however it doesn't work for
``:doc:`` as that is non-domain role.
-|more| See :mod:`sphinx.ext.intersphinx` for the complete description of the
-features of intersphinx.
+.. seealso::
+
+ :mod:`sphinx.ext.intersphinx`
+ for the complete description of the features of intersphinx.
More topics to be covered
@@ -342,7 +324,3 @@ More topics to be covered
.. [#] This is the usual layout. However, :file:`conf.py` can also live in
another directory, the :term:`configuration directory`. Refer to the
:doc:`sphinx-build man page </man/sphinx-build>` for more information.
-
-.. |more| image:: /_static/more.png
- :align: middle
- :alt: more info
diff --git a/doc/usage/referencing.rst b/doc/usage/referencing.rst
new file mode 100644
index 0000000..5761166
--- /dev/null
+++ b/doc/usage/referencing.rst
@@ -0,0 +1,269 @@
+.. _xref-syntax:
+
+========================
+Cross-referencing syntax
+========================
+
+Cross-references are generated by many semantic interpreted text roles.
+Basically, you only need to write ``:role:`target```, and a link will be
+created to the item named *target* of the type indicated by *role*. The link's
+text will be the same as *target*.
+
+There are some additional facilities, however, that make cross-referencing
+roles more versatile:
+
+* You may supply an explicit title and reference target,
+ like in reStructuredText direct hyperlinks:
+ ``:role:`title <target>``` will refer to *target*,
+ but the link text will be *title*.
+
+* If you prefix the content with ``!``, no reference/hyperlink will be created.
+
+* If you prefix the content with ``~``, the link text will only be the last
+ component of the target. For example, ``:py:meth:`~Queue.Queue.get``` will
+ refer to ``Queue.Queue.get`` but only display ``get`` as the link text. This
+ does not work with all cross-reference roles, but is domain specific.
+
+ In HTML output, the link's ``title`` attribute (that is e.g. shown as a
+ tool-tip on mouse-hover) will always be the full target name.
+
+
+.. _any-role:
+
+Cross-referencing anything
+--------------------------
+
+.. rst:role:: any
+
+ .. versionadded:: 1.3
+
+ This convenience role tries to do its best to find a valid target for its
+ reference text.
+
+ * First, it tries standard cross-reference targets that would be referenced
+ by :rst:role:`doc`, :rst:role:`ref` or :rst:role:`option`.
+
+ Custom objects added to the standard domain by extensions (see
+ :meth:`.Sphinx.add_object_type`) are also searched.
+
+ * Then, it looks for objects (targets) in all loaded domains. It is up to
+ the domains how specific a match must be. For example, in the Python
+ domain a reference of ``:any:`Builder``` would match the
+ ``sphinx.builders.Builder`` class.
+
+ If none or multiple targets are found, a warning will be emitted. In the
+ case of multiple targets, you can change "any" to a specific role.
+
+ This role is a good candidate for setting :confval:`default_role`. If you
+ do, you can write cross-references without a lot of markup overhead. For
+ example, in this Python function documentation::
+
+ .. function:: install()
+
+ This function installs a `handler` for every signal known by the
+ `signal` module. See the section `about-signals` for more information.
+
+ there could be references to a glossary term (usually ``:term:`handler```), a
+ Python module (usually ``:py:mod:`signal``` or ``:mod:`signal```) and a
+ section (usually ``:ref:`about-signals```).
+
+ The :rst:role:`any` role also works together with the
+ :mod:`~sphinx.ext.intersphinx` extension: when no local cross-reference is
+ found, all object types of intersphinx inventories are also searched.
+
+Cross-referencing objects
+-------------------------
+
+These roles are described with their respective domains:
+
+* :ref:`Python <python-xref-roles>`
+* :ref:`C <c-xref-roles>`
+* :ref:`C++ <cpp-xref-roles>`
+* :ref:`JavaScript <js-xref-roles>`
+* :ref:`reStructuredText <rst-xref-roles>`
+
+
+.. _ref-role:
+
+Cross-referencing arbitrary locations
+-------------------------------------
+
+.. rst:role:: ref
+
+ To support cross-referencing to arbitrary locations in any document,
+ the standard reStructuredText labels are used.
+ For this to work label names must be unique
+ throughout the entire documentation.
+ There are two ways in which you can refer to labels:
+
+ * If you place a label directly before a section title, you can reference to
+ it with ``:ref:`label-name```. For example::
+
+ .. _my-reference-label:
+
+ Section to cross-reference
+ --------------------------
+
+ This is the text of the section.
+
+ It refers to the section itself, see :ref:`my-reference-label`.
+
+ The ``:ref:`` role would then generate a link to the section, with the
+ link title being "Section to cross-reference". This works just as well
+ when section and reference are in different source files.
+
+ Automatic labels also work with figures. For example::
+
+ .. _my-figure:
+
+ .. figure:: whatever
+
+ Figure caption
+
+ In this case, a reference ``:ref:`my-figure``` would insert a reference
+ to the figure with link text "Figure caption".
+
+ The same works for tables that are given an explicit caption using the
+ :dudir:`table` directive.
+
+ * Labels that aren't placed before a section title can still be referenced,
+ but you must give the link an explicit title, using this syntax:
+ ``:ref:`Link title <label-name>```.
+
+ .. note::
+
+ Reference labels must start with an underscore. When referencing a label,
+ the underscore must be omitted (see examples above).
+
+ Using :rst:role:`ref` is advised over standard reStructuredText links to
+ sections (like ```Section title`_``) because it works across files, when
+ section headings are changed, will raise warnings if incorrect, and works
+ for all builders that support cross-references.
+
+
+Cross-referencing documents
+---------------------------
+
+.. versionadded:: 0.6
+
+There is also a way to directly link to documents:
+
+.. rst:role:: doc
+
+ Link to the specified document; the document name can be specified in
+ absolute or relative fashion. For example, if the reference
+ ``:doc:`parrot``` occurs in the document ``sketches/index``, then the link
+ refers to ``sketches/parrot``. If the reference is ``:doc:`/people``` or
+ ``:doc:`../people```, the link refers to ``people``.
+
+ If no explicit link text is given (like usual: ``:doc:`Monty Python members
+ </people>```), the link caption will be the title of the given document.
+
+
+Referencing downloadable files
+------------------------------
+
+.. versionadded:: 0.6
+
+.. rst:role:: download
+
+ This role lets you link to files within your source tree
+ that are not reStructuredText documents that can be viewed,
+ but files that can be downloaded.
+
+ When you use this role, the referenced file is automatically marked for
+ inclusion in the output when building (obviously, for HTML output only).
+ All downloadable files are put into a ``_downloads/<unique hash>/``
+ subdirectory of the output directory; duplicate filenames are handled.
+
+ An example::
+
+ See :download:`this example script <../example.py>`.
+
+ The given filename is usually relative to the directory the current source
+ file is contained in, but if it absolute (starting with ``/``), it is taken
+ as relative to the top source directory.
+
+ The ``example.py`` file will be copied to the output directory, and a
+ suitable link generated to it.
+
+ Not to show unavailable download links, you should wrap whole paragraphs that
+ have this role::
+
+ .. only:: builder_html
+
+ See :download:`this example script <../example.py>`.
+
+Cross-referencing figures by figure number
+------------------------------------------
+
+.. versionadded:: 1.3
+
+.. versionchanged:: 1.5
+ :rst:role:`numref` role can also refer sections.
+ And :rst:role:`numref` allows ``{name}`` for the link text.
+
+.. rst:role:: numref
+
+ Link to the specified figures, tables, code-blocks and sections;
+ the standard reStructuredText labels are used.
+ When you use this role, it will insert a reference to
+ the figure with link text by its figure number like "Fig. 1.1".
+
+ If an explicit link text is given (as usual: ``:numref:`Image of Sphinx (Fig.
+ %s) <my-figure>```), the link caption will serve as title of the reference.
+ As placeholders, `%s` and `{number}` get replaced by the figure
+ number and `{name}` by the figure caption.
+ If no explicit link text is given, the :confval:`numfig_format` setting is
+ used as fall-back default.
+
+ If :confval:`numfig` is ``False``, figures are not numbered,
+ so this role inserts not a reference but the label or the link text.
+
+Cross-referencing other items of interest
+-----------------------------------------
+
+The following roles do possibly create a cross-reference, but do not refer to
+objects:
+
+.. rst:role:: confval
+
+ A configuration value or setting.
+ Index entries are generated.
+ Also generates a link to the matching :rst:dir:`confval` directive,
+ if it exists.
+
+.. rst:role:: envvar
+
+ An environment variable. Index entries are generated. Also generates a link
+ to the matching :rst:dir:`envvar` directive, if it exists.
+
+.. rst:role:: token
+
+ The name of a grammar token (used to create links between
+ :rst:dir:`productionlist` directives).
+
+.. rst:role:: keyword
+
+ The name of a keyword in Python. This creates a link to a reference label
+ with that name, if it exists.
+
+.. rst:role:: option
+
+ A command-line option to an executable program. This generates a link to
+ a :rst:dir:`option` directive, if it exists.
+
+
+The following role creates a cross-reference to a term in a
+:ref:`glossary <glossary-directive>`:
+
+.. rst:role:: term
+
+ Reference to a term in a glossary. A glossary is created using the
+ ``glossary`` directive containing a definition list with terms and
+ definitions. It does not have to be in the same file as the ``term`` markup,
+ for example the Python docs have one global glossary in the ``glossary.rst``
+ file.
+
+ If you use a term that's not explained in a glossary, you'll get a warning
+ during build.
diff --git a/doc/usage/restructuredtext/basics.rst b/doc/usage/restructuredtext/basics.rst
index cc3c615..5354748 100644
--- a/doc/usage/restructuredtext/basics.rst
+++ b/doc/usage/restructuredtext/basics.rst
@@ -9,24 +9,26 @@ reStructuredText Primer
reStructuredText is the default plaintext markup language used by Sphinx. This
section is a brief introduction to reStructuredText (reST) concepts and syntax,
intended to provide authors with enough information to author documents
-productively. Since reST was designed to be a simple, unobtrusive markup
+productively. Since reStructuredText was designed to be a simple, unobtrusive markup
language, this will not take too long.
.. seealso::
The authoritative `reStructuredText User Documentation
- <https://docutils.sourceforge.io/rst.html>`_. The "ref" links in this
- document link to the description of the individual constructs in the reST
- reference.
+ <https://docutils.sourceforge.io/rst.html>`_.
+ The "ref" links in this document link to the description of
+ the individual constructs in the reStructuredText reference.
Paragraphs
----------
-The paragraph (:duref:`ref <paragraphs>`) is the most basic block in a reST
-document. Paragraphs are simply chunks of text separated by one or more blank
-lines. As in Python, indentation is significant in reST, so all lines of the
-same paragraph must be left-aligned to the same level of indentation.
+The paragraph (:duref:`ref <paragraphs>`) is the most basic block
+in a reStructuredText document.
+Paragraphs are simply chunks of text separated by one or more blank lines.
+As in Python, indentation is significant in reStructuredText,
+so all lines of the same paragraph must be left-aligned
+to the same level of indentation.
.. _rst-inline-markup:
@@ -34,7 +36,7 @@ same paragraph must be left-aligned to the same level of indentation.
Inline markup
-------------
-The standard reST inline markup is quite simple: use
+The standard reStructuredText inline markup is quite simple: use
* one asterisk: ``*text*`` for emphasis (italics),
* two asterisks: ``**text**`` for strong emphasis (boldface), and
@@ -53,7 +55,7 @@ Be aware of some restrictions of this markup:
These restrictions may be lifted in future versions of the docutils.
It is also possible to replace or expand upon some of this inline markup with
-roles. Refer to :ref:`rst-roles-alt` for more information.
+roles. Refer to :ref:`rst-roles` for more information.
Lists and Quote-like blocks
@@ -220,8 +222,8 @@ You can also separate the link and the target definition (:duref:`ref
Internal links
~~~~~~~~~~~~~~
-Internal linking is done via a special reST role provided by Sphinx, see the
-section on specific markup, :ref:`ref-role`.
+Internal linking is done via a special reStructuredText role provided by Sphinx,
+see the section on specific markup, :ref:`ref-role`.
.. _rst-sections:
@@ -250,7 +252,7 @@ follow:
* ``^`` for subsubsections
* ``"`` for paragraphs
-Of course, you are free to use your own marker characters (see the reST
+Of course, you are free to use your own marker characters (see the reStructuredText
documentation), and use a deeper nesting level, but keep in mind that most
target formats (HTML, LaTeX) have a limited supported nesting depth.
@@ -281,15 +283,12 @@ at the beginning of documents. Refer to :doc:`field-lists` for more
information.
-.. TODO This ref should be 'rst-roles', but that already exists. Rename the
-.. other ones
-
-.. _rst-roles-alt:
+.. _rst-roles:
Roles
-----
-A role or "custom interpreted text role" (:duref:`ref <roles>`) is an inline
+A role or "custom interpreted text role" (:dupage:`ref <roles>`) is an inline
piece of explicit markup. It signifies that the enclosed text should be
interpreted in a specific way. Sphinx uses this to provide semantic markup and
cross-referencing of identifiers, as described in the appropriate section. The
@@ -311,8 +310,8 @@ Refer to :doc:`roles` for roles added by Sphinx.
Explicit Markup
---------------
-"Explicit markup" (:duref:`ref <explicit-markup-blocks>`) is used in reST for
-most constructs that need special handling, such as footnotes,
+"Explicit markup" (:duref:`ref <explicit-markup-blocks>`) is used in
+reStructuredText for most constructs that need special handling, such as footnotes,
specially-highlighted paragraphs, comments, and generic directives.
An explicit markup block begins with a line starting with ``..`` followed by
@@ -328,8 +327,8 @@ Directives
----------
A directive (:duref:`ref <directives>`) is a generic block of explicit markup.
-Along with roles, it is one of the extension mechanisms of reST, and Sphinx
-makes heavy use of it.
+Along with roles, it is one of the extension mechanisms of reStructuredText,
+and Sphinx makes heavy use of it.
Docutils supports the following directives:
@@ -380,6 +379,12 @@ Docutils supports the following directives:
When the default domain contains a ``class`` directive, this directive
will be shadowed. Therefore, Sphinx re-exports it as ``rst-class``.
+ .. tip::
+
+ If you want to add a class to a directive,
+ you may consider the ``:class:`` :dudir:`option <common-options>` instead,
+ which is supported by most directives and allows for a more compact notation.
+
* HTML specifics:
- :dudir:`meta`
@@ -444,7 +449,7 @@ it does not start with a space.
Images
------
-reST supports an image directive (:dudir:`ref <image>`), used like so::
+reStructuredText supports an image directive (:dudir:`ref <image>`), used like so::
.. image:: gnu.png
(options)
@@ -510,9 +515,9 @@ footnotes without names (``[#]_``).
Citations
---------
-Standard reST citations (:duref:`ref <citations>`) are supported, with the
-additional feature that they are "global", i.e. all citations can be referenced
-from all files. Use them like so::
+Standard reStructuredText citations (:duref:`ref <citations>`) are supported,
+with the additional feature that they are "global",
+i.e. all citations can be referenced from all files. Use them like so::
Lorem ipsum [Ref]_ dolor sit amet.
@@ -525,9 +530,9 @@ numeric or begins with ``#``.
Substitutions
-------------
-reST supports "substitutions" (:duref:`ref <substitution-definitions>`), which
-are pieces of text and/or markup referred to in the text by ``|name|``. They
-are defined like footnotes with explicit markup blocks, like this::
+reStructuredText supports "substitutions" (:duref:`ref <substitution-definitions>`),
+which are pieces of text and/or markup referred to in the text by ``|name|``.
+They are defined like footnotes with explicit markup blocks, like this::
.. |name| replace:: replacement *text*
@@ -536,8 +541,8 @@ or this::
.. |caution| image:: warning.png
:alt: Warning!
-See the :duref:`reST reference for substitutions <substitution-definitions>`
-for details.
+See the :duref:`reStructuredText reference for substitutions
+<substitution-definitions>` for details.
.. index:: ! pair: global; substitutions
@@ -584,7 +589,7 @@ directive::
will generate the following HTML output:
-.. code:: html
+.. code-block:: html
<meta name="description" content="The Sphinx documentation builder">
<meta name="keywords" content="Sphinx, documentation, builder">
@@ -612,7 +617,7 @@ Source encoding
---------------
Since the easiest way to include special characters like em dashes or copyright
-signs in reST is to directly write them as Unicode characters, one has to
+signs in reStructuredText is to directly write them as Unicode characters, one has to
specify an encoding. Sphinx assumes source files to be encoded in UTF-8 by
default; you can change this with the :confval:`source_encoding` config value.
@@ -620,7 +625,8 @@ default; you can change this with the :confval:`source_encoding` config value.
Gotchas
-------
-There are some problems one commonly runs into while authoring reST documents:
+There are some problems one commonly runs into
+while authoring reStructuredText documents:
* **Separation of inline markup:** As said above, inline markup spans must be
separated from the surrounding text by non-word characters, you have to use a
diff --git a/doc/usage/restructuredtext/directives.rst b/doc/usage/restructuredtext/directives.rst
index 1fd5b66..19079d2 100644
--- a/doc/usage/restructuredtext/directives.rst
+++ b/doc/usage/restructuredtext/directives.rst
@@ -9,7 +9,7 @@ of explicit markup. While Docutils provides a number of directives, Sphinx
provides many more and uses directives as one of the primary extension
mechanisms.
-See :doc:`/usage/restructuredtext/domains` for roles added by domains.
+See :doc:`/usage/domains/index` for roles added by domains.
.. seealso::
@@ -24,10 +24,11 @@ Table of contents
.. index:: pair: table of; contents
-Since reST does not have facilities to interconnect several documents, or split
-documents into multiple output files, Sphinx uses a custom directive to add
-relations between the single files the documentation is made of, as well as
-tables of contents. The ``toctree`` directive is the central element.
+Since reStructuredText does not have facilities to interconnect several documents,
+or split documents into multiple output files,
+Sphinx uses a custom directive to add relations between
+the single files the documentation is made of, as well as tables of contents.
+The ``toctree`` directive is the central element.
.. note::
@@ -37,7 +38,7 @@ tables of contents. The ``toctree`` directive is the central element.
.. note::
To create table of contents for current document (.rst file), use the
- standard reST :dudir:`contents directive <table-of-contents>`.
+ standard reStructuredText :dudir:`contents directive <table-of-contents>`.
.. rst:directive:: toctree
@@ -49,8 +50,8 @@ tables of contents. The ``toctree`` directive is the central element.
indicate the depth of the tree; by default, all levels are included. [#]_
The representation of "TOC tree" is changed in each output format. The
- builders that output multiple files (ex. HTML) treat it as a collection of
- hyperlinks. On the other hand, the builders that output a single file (ex.
+ builders that output multiple files (e.g. HTML) treat it as a collection of
+ hyperlinks. On the other hand, the builders that output a single file (e.g.
LaTeX, man page, etc.) replace it with the content of the documents on the
TOC tree.
@@ -79,7 +80,7 @@ tables of contents. The ``toctree`` directive is the central element.
Document titles in the :rst:dir:`toctree` will be automatically read from the
title of the referenced document. If that isn't what you want, you can
- specify an explicit title and target using a similar syntax to reST
+ specify an explicit title and target using a similar syntax to reStructuredText
hyperlinks (and Sphinx's :ref:`cross-referencing syntax <xref-syntax>`). This
looks like::
@@ -124,6 +125,14 @@ tables of contents. The ``toctree`` directive is the central element.
foo
+ As with :dudir:`most directives <common-options>`,
+ you can use the ``class`` option to assign `class attributes`_::
+
+ .. toctree::
+ :class: custom-toc
+
+ .. _class attributes: https://docutils.sourceforge.io/docs/ref/doctree.html#classes
+
If you want only the titles of documents in the tree to show up, not other
headings of the same level, you can use the ``titlesonly`` option::
@@ -223,138 +232,327 @@ tables of contents. The ``toctree`` directive is the central element.
Special names
^^^^^^^^^^^^^
+.. index:: pair: genindex; toctree
+ pair: modindex; toctree
+ pair: search; toctree
+
Sphinx reserves some document names for its own use; you should not try to
create documents with these names -- it will cause problems.
The special document names (and pages generated for them) are:
-* ``genindex``, ``modindex``, ``search``
+* ``genindex``
- These are used for the general index, the Python module index, and the search
- page, respectively.
+ This is used for the general index,
+ which is populated with entries from :rst:dir:`index` directives
+ and all index-generating :ref:`object descriptions <basic-domain-markup>`.
+ For example, see Sphinx's :ref:`genindex`.
- The general index is populated with entries from modules, all
- index-generating :ref:`object descriptions <basic-domain-markup>`, and from
- :rst:dir:`index` directives.
+* ``modindex``
- The Python module index contains one entry per :rst:dir:`py:module`
- directive.
+ This is used for the Python module index,
+ which contains one entry per :rst:dir:`py:module` directive.
+ For example, see Sphinx's :ref:`py-modindex`.
- The search page contains a form that uses the generated JSON search index and
- JavaScript to full-text search the generated documents for search words; it
- should work on every major browser that supports modern JavaScript.
+* ``search``
-* every name beginning with ``_``
+ This is used for the search page,
+ which contains a form that uses the generated JSON search index and JavaScript
+ to full-text search the generated documents for search words;
+ it works on every major browser.
+ For example, see Sphinx's :ref:`search`.
- Though few such names are currently used by Sphinx, you should not
- create documents or document-containing directories with such names. (Using
- ``_`` as a prefix for a custom template directory is fine.)
+* Every name beginning with ``_``
-.. warning::
+ Though few such names are currently used by Sphinx,
+ you should not create documents or document-containing directories with such names.
+ (Using ``_`` as a prefix for a custom template directory is fine.)
- Be careful with unusual characters in filenames. Some formats may interpret
- these characters in unexpected ways:
+.. warning::
- * Do not use the colon ``:`` for HTML based formats. Links to other parts
- may not work.
+ Be careful with unusual characters in filenames.
+ Some formats may interpret these characters in unexpected ways:
- * Do not use the plus ``+`` for the ePub format. Some resources may not be
- found.
+ * Do not use the colon ``:`` for HTML based formats.
+ Links to other parts may not work.
+ * Do not use the plus ``+`` for the ePub format.
+ Some resources may not be found.
Paragraph-level markup
----------------------
-.. index:: note, warning
- pair: changes; in version
-
These directives create short paragraphs and can be used inside information
units as well as normal text.
+
+Admonitions, messages, and warnings
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. index:: admonition, admonitions
+ pair: attention; admonition
+ pair: caution; admonition
+ pair: danger; admonition
+ pair: error; admonition
+ pair: hint; admonition
+ pair: important; admonition
+ pair: note; admonition
+ pair: tip; admonition
+ pair: warning; admonition
+
+The admonition directives create 'admonition' elements,
+a standardised system of communicating different types of information,
+from a helpful :rst:dir:`tip` to matters of paramount :rst:dir:`danger`.
+These directives can be used anywhere an ordinary body element can,
+and can contain arbitrary body elements.
+There are nine specific named admonitions
+and the generic :rst:dir:`admonition` directive.
+
+.. rst:directive:: .. attention::
+
+ Information that requires the reader's attention.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. attention::
+
+ Please may I have your attention.
+
+.. rst:directive:: .. caution::
+
+ Information with regard to which the reader should exercise care.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. caution::
+
+ Exercise due caution.
+
+.. rst:directive:: .. danger::
+
+ Information which may lead to near and present danger if not heeded.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. danger::
+
+ Let none think to fly the danger for soon or late love is his own avenger.
+
+.. rst:directive:: .. error::
+
+ Information relating to failure modes of some description.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. error::
+
+ ERROR 418: I'm a teapot.
+
+.. rst:directive:: .. hint::
+
+ Information that is helpful to the reader.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. hint::
+
+ Look under the flowerpot.
+
+.. rst:directive:: .. important::
+
+ Information that is of paramount importance
+ and which the reader must not ignore.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. important::
+
+ This is a statement of paramount importance.
+
.. rst:directive:: .. note::
- An especially important bit of information about an API that a user should be
- aware of when using whatever bit of API the note pertains to. The content of
- the directive should be written in complete sentences and include all
- appropriate punctuation.
+ An especially important bit of information that the reader should know.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
- Example::
+ Example:
+
+ .. note::
+
+ This function is not suitable for sending tins of spam.
+
+.. rst:directive:: .. tip::
+
+ Some useful tidbit of information for the reader.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
- .. note::
+ Example:
- This function is not suitable for sending spam e-mails.
+ .. tip::
+
+ Remember your sun cream!
.. rst:directive:: .. warning::
- An important bit of information about an API that a user should be very aware
- of when using whatever bit of API the warning pertains to. The content of
- the directive should be written in complete sentences and include all
- appropriate punctuation. This differs from :rst:dir:`note` in that it is
- recommended over :rst:dir:`note` for information regarding security.
+ An important bit of information that the reader should be very aware of.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. warning::
+
+ Beware of the dog.
+
+.. rst:directive:: .. admonition:: title
+
+ A generic admonition, with an optional title.
+ The content of the directive should be written in complete sentences
+ and include all appropriate punctuation.
+
+ Example:
+
+ .. admonition:: This is a title
+
+ This is the content of the admonition.
+
+
+.. rst:directive:: seealso
+
+ Many sections include a list of references to module documentation or
+ external documents.
+ These lists are created using the :rst:dir:`seealso` directive.
+
+ The :rst:dir:`!seealso` directive is typically placed in a section
+ just before any subsections.
+ The content of the :rst:dir:`seealso` directive should be
+ either a single line or a reStructuredText `definition list`_.
+
+ .. _definition list: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#definition-lists
+
+ Example::
+
+ .. seealso::
+
+ Python's :py:mod:`zipfile` module
+ Documentation of Python's standard :py:mod:`zipfile` module.
+
+ `GNU tar manual, Basic Tar Format <https://example.org>`_
+ Documentation for tar archive files, including GNU tar extensions.
+
+ .. seealso::
+
+ Module :py:mod:`zipfile`
+ Documentation of the :py:mod:`zipfile` standard module.
+
+ `GNU tar manual, Basic Tar Format <https://example.org>`_
+ Documentation for tar archive files, including GNU tar extensions.
+
+
+Describing changes between versions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. index:: pair: added; in version
+ pair: changes; in version
+ pair: removed; in version
-.. rst:directive:: .. versionadded:: version
+.. rst:directive:: .. versionadded:: version [brief explanation]
- This directive documents the version of the project which added the described
- feature to the library or C API. When this applies to an entire module, it
- should be placed at the top of the module section before any prose.
+ This directive documents the version of the project
+ which added the described feature.
+ When this applies to an entire module or component,
+ it should be placed at the top of the relevant section before any prose.
The first argument must be given and is the version in question; you can add
a second argument consisting of a *brief* explanation of the change.
+ .. attention::
+ There must be no blank line between the directive head and the explanation;
+ this is to make these blocks visually continuous in the markup.
+
Example::
.. versionadded:: 2.5
The *spam* parameter.
- Note that there must be no blank line between the directive head and the
- explanation; this is to make these blocks visually continuous in the markup.
+ .. versionadded:: 2.5
+ The *spam* parameter.
-.. rst:directive:: .. versionchanged:: version
+.. rst:directive:: .. versionchanged:: version [brief explanation]
Similar to :rst:dir:`versionadded`, but describes when and what changed in
the named feature in some way (new parameters, changed side effects, etc.).
-.. rst:directive:: .. deprecated:: version
+ Example::
- Similar to :rst:dir:`versionchanged`, but describes when the feature was
- deprecated. An explanation can also be given, for example to inform the
- reader what should be used instead. Example::
+ .. versionchanged:: 2.8
+ The *spam* parameter is now of type *boson*.
- .. deprecated:: 3.1
- Use :func:`spam` instead.
+ .. versionchanged:: 2.8
+ The *spam* parameter is now of type *boson*.
-.. rst:directive:: seealso
+.. rst:directive:: .. deprecated:: version [brief explanation]
- Many sections include a list of references to module documentation or
- external documents. These lists are created using the :rst:dir:`seealso`
- directive.
+ Similar to :rst:dir:`versionadded`, but describes when the feature was
+ deprecated.
+ A *brief* explanation can also be given,
+ for example to tell the reader what to use instead.
- The :rst:dir:`seealso` directive is typically placed in a section just before
- any subsections. For the HTML output, it is shown boxed off from the main
- flow of the text.
+ Example::
- The content of the :rst:dir:`seealso` directive should be a reST definition
- list. Example::
+ .. deprecated:: 3.1
+ Use :py:func:`spam` instead.
- .. seealso::
+ .. deprecated:: 3.1
+ Use :py:func:`!spam` instead.
- Module :py:mod:`zipfile`
- Documentation of the :py:mod:`zipfile` standard module.
+.. rst:directive:: .. versionremoved:: version [brief explanation]
- `GNU tar manual, Basic Tar Format <http://link>`_
- Documentation for tar archive files, including GNU tar extensions.
+ Similar to :rst:dir:`versionadded`, but describes when the feature was removed.
+ An explanation may be provided to tell the reader what to use instead,
+ or why the feature was removed.
+
+ .. versionadded:: 7.3
+
+ Example::
+
+ .. versionremoved:: 4.0
+ The :py:func:`spam` function is more flexible, and should be used instead.
- There's also a "short form" allowed that looks like this::
+ .. versionremoved:: 4.0
+ The :py:func:`!spam` function is more flexible, and should be used instead.
- .. seealso:: modules :py:mod:`zipfile`, :py:mod:`tarfile`
- .. versionadded:: 0.5
- The short form.
+Presentational
+^^^^^^^^^^^^^^
.. rst:directive:: .. rubric:: title
- This directive creates a paragraph heading that is not used to create a
- table of contents node.
+ A rubric is like an informal heading that doesn't correspond to the document's structure,
+ i.e. it does not create a table of contents node.
+
+ .. rst:directive:option:: heading-level: n
+ :type: number from 1 to 6
+
+ .. versionadded:: 7.4.1
+
+ Use this option to specify the heading level of the rubric.
+ In this case the rubric will be rendered as ``<h1>`` to ``<h6>`` for HTML output,
+ or as the corresponding non-numbered sectioning command for LaTeX
+ (see :confval:`latex_toplevel_sectioning`).
.. note::
@@ -365,10 +563,7 @@ units as well as normal text.
.. rst:directive:: centered
- This directive creates a centered boldfaced line of text. Use it as
- follows::
-
- .. centered:: LICENSE AGREEMENT
+ This directive creates a centered boldfaced line of text.
.. deprecated:: 1.1
This presentation-only directive is a legacy from older versions.
@@ -407,8 +602,8 @@ Showing code examples
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
+* using :ref:`reStructuredText doctest blocks <rst-doctest-blocks>`;
+* using :ref:`reStructuredText 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.
@@ -491,6 +686,7 @@ __ https://pygments.org/docs/lexers
.. rst:directive:: .. code-block:: [language]
.. sourcecode:: [language]
+ .. code:: [language]
Example::
@@ -544,9 +740,9 @@ __ https://pygments.org/docs/lexers
def some_function():
interesting = False
- print 'This line is highlighted.'
- print 'This one is not...'
- print '...but this one is.'
+ print('This line is highlighted.')
+ print('This one is not...')
+ print('...but this one is.')
.. versionadded:: 1.1
.. versionchanged:: 1.6.6
@@ -576,7 +772,7 @@ __ https://pygments.org/docs/lexers
:caption: this.py
:name: this-py
- print 'Explicit is better than implicit.'
+ print('Explicit is better than implicit.')
In order to cross-reference a code-block using either the
:rst:role:`ref` or the :rst:role:`numref` role, it is necessary
@@ -790,8 +986,8 @@ Glossary
.. rst:directive:: .. glossary::
- This directive must contain a reST definition-list-like markup with terms and
- definitions. The definitions will then be referenceable with the
+ This directive must contain a reStructuredText definition-list-like markup
+ with terms and definitions. The definitions will then be referenceable with the
:rst:role:`term` role. Example::
.. glossary::
@@ -881,7 +1077,7 @@ Index-generating markup
Sphinx automatically creates index entries from all object descriptions (like
functions, classes or attributes) like discussed in
-:doc:`/usage/restructuredtext/domains`.
+:doc:`/usage/domains/index`.
However, there is also explicit markup available, to make the index more
comprehensive and enable index entries in documents where information is not
@@ -922,7 +1118,7 @@ mainly contained in information units, such as the language reference.
(this notation is also used below to describe what entries are created).
Examples:
- .. code:: reStructuredText
+ .. code-block:: rst
.. index:: single: execution
single: execution; context
@@ -935,7 +1131,7 @@ mainly contained in information units, such as the language reference.
The pair of values must be separated by a semicolon.
Example:
- .. code:: reStructuredText
+ .. code-block:: rst
.. index:: pair: loop; statement
@@ -945,7 +1141,7 @@ mainly contained in information units, such as the language reference.
All three values must be separated by a semicolon.
Example:
- .. code:: reStructuredText
+ .. code-block:: rst
.. index:: triple: module; search; path
@@ -955,7 +1151,7 @@ mainly contained in information units, such as the language reference.
A shortcut to create an index entry that refers to another entry.
Example:
- .. code:: reStructuredText
+ .. code-block:: rst
.. index:: see: entry; other
@@ -1022,7 +1218,7 @@ mainly contained in information units, such as the language reference.
case, the "target" part can be a full entry as described for the directive
above. For example::
- This is a normal reST :index:`paragraph` that contains several
+ This is a normal reStructuredText :index:`paragraph` that contains several
:index:`index entries <pair: index; entry>`.
.. versionadded:: 1.1
@@ -1040,10 +1236,11 @@ Including content based on tags
.. only:: html and draft
- Undefined tags are false, defined tags (via the ``-t`` command-line option or
- within :file:`conf.py`, see :ref:`here <conf-tags>`) are true. Boolean
- expressions, also using parentheses (like ``html and (latex or draft)``) are
- supported.
+ Undefined tags are false, defined tags are true
+ (tags can be defined via the :option:`--tag <sphinx-build --tag>`
+ command-line option or within :file:`conf.py`, see :ref:`here <conf-tags>`).
+ Boolean expressions (like ``(latex or html) and draft``) are supported
+ and may use parentheses.
The *format* and the *name* of the current builder (``html``, ``latex`` or
``text``) are always set as a tag [#]_. To make the distinction between
@@ -1275,8 +1472,8 @@ the definition of the symbol. There is this directive:
an explicit title can be given (e.g., "``myTitle <myGroup:sum>``"),
or the target can be prefixed with a tilde (e.g., "``~myGroup:sum``").
- Note that no further reST parsing is done in the production, so that you
- don't have to escape ``*`` or ``|`` characters.
+ Note that no further reStructuredText parsing is done in the production,
+ so that you don't have to escape ``*`` or ``|`` characters.
The following is an example taken from the Python Reference Manual::
diff --git a/doc/usage/restructuredtext/domains.rst b/doc/usage/restructuredtext/domains.rst
index 729e651..3d9bd49 100644
--- a/doc/usage/restructuredtext/domains.rst
+++ b/doc/usage/restructuredtext/domains.rst
@@ -1,2303 +1,278 @@
-.. highlight:: rst
+==============
+MOVED: Domains
+==============
-=======
-Domains
-=======
-
-.. versionadded:: 1.0
-
-Originally, Sphinx was conceived for a single project, the documentation of the
-Python language. Shortly afterwards, it was made available for everyone as a
-documentation tool, but the documentation of Python modules remained deeply
-built in -- the most fundamental directives, like ``function``, were designed
-for Python objects. Since Sphinx has become somewhat popular, interest
-developed in using it for many different purposes: C/C++ projects, JavaScript,
-or even reStructuredText markup (like in this documentation).
-
-While this was always possible, it is now much easier to easily support
-documentation of projects using different programming languages or even ones
-not supported by the main Sphinx distribution, by providing a **domain** for
-every such purpose.
-
-A domain is a collection of markup (reStructuredText :term:`directive`\ s and
-:term:`role`\ s) to describe and link to :term:`object`\ s belonging together,
-e.g. elements of a programming language. Directive and role names in a domain
-have names like ``domain:name``, e.g. ``py:function``. Domains can also
-provide custom indices (like the Python Module Index).
-
-Having domains means that there are no naming problems when one set of
-documentation wants to refer to e.g. C++ and Python classes. It also means
-that extensions that support the documentation of whole new languages are much
-easier to write.
-
-This section describes what the domains that are included with Sphinx provide.
-The domain API is documented as well, in the section :ref:`domain-api`.
-
-
-.. _basic-domain-markup:
-
-Basic Markup
-------------
-
-Most domains provide a number of :dfn:`object description directives`, used to
-describe specific objects provided by modules. Each directive requires one or
-more signatures to provide basic information about what is being described, and
-the content should be the description.
-
-A domain will typically keep an internal index of all entities to aid
-cross-referencing.
-Typically it will also add entries in the shown general index.
-If you want to suppress the addition of an entry in the shown index, you can
-give the directive option flag ``:no-index-entry:``.
-If you want to exclude the object description from the table of contents, you
-can give the directive option flag ``:no-contents-entry:``.
-If you want to typeset an object description, without even making it available
-for cross-referencing, you can give the directive option flag ``:no-index:``
-(which implies ``:no-index-entry:``).
-If you do not want to typeset anything, you can give the directive option flag
-``:no-typesetting:``. This can for example be used to create only a target and
-index entry for later reference.
-Though, note that not every directive in every domain may support these
-options.
-
-.. versionadded:: 3.2
- The directive option ``noindexentry`` in the Python, C, C++, and Javascript
- domains.
-
-.. versionadded:: 5.2.3
- The directive option ``:nocontentsentry:`` in the Python, C, C++, Javascript,
- and reStructuredText domains.
-
-.. versionadded:: 7.2
- The directive option ``no-typesetting`` in the Python, C, C++, Javascript,
- and reStructuredText domains.
-
-.. versionchanged:: 7.2
-
- * The directive option ``:noindex:`` was renamed
- to ``:no-index:``.
- * The directive option ``:noindexentry:`` was renamed
- to ``:no-index-entry:``.
- * The directive option ``:nocontentsentry:`` was renamed
- to ``:no-contents-entry:``.
-
- The previous names are retained as aliases,
- but will be deprecated and removed
- in a future version of Sphinx.
-
-An example using a Python domain directive::
-
- .. py:function:: spam(eggs)
- ham(eggs)
-
- Spam or ham the foo.
-
-This describes the two Python functions ``spam`` and ``ham``. (Note that when
-signatures become too long, you can break them if you add a backslash to lines
-that are continued in the next line. Example::
-
- .. py:function:: filterwarnings(action, message='', category=Warning, \
- module='', lineno=0, append=False)
- :no-index:
-
-(This example also shows how to use the ``:no-index:`` flag.)
-
-The domains also provide roles that link back to these object descriptions.
-For example, to link to one of the functions described in the example above,
-you could say ::
-
- The function :py:func:`spam` does a similar thing.
-
-As you can see, both directive and role names contain the domain name and the
-directive name.
-
-The directive option ``:no-typesetting:`` can be used to create a target
-(and index entry) which can later be referenced
-by the roles provided by the domain.
-This is particularly useful for literate programming:
-
-.. code-block:: rst
-
- .. py:function:: spam(eggs)
- :no-typesetting:
-
- .. code::
-
- def spam(eggs):
- pass
-
- The function :py:func:`spam` does nothing.
-
-.. rubric:: Default Domain
-
-For documentation describing objects from solely one domain, authors will not
-have to state again its name at each directive, role, etc... after
-having specified a default. This can be done either via the config
-value :confval:`primary_domain` or via this directive:
-
-.. rst:directive:: .. default-domain:: name
-
- Select a new default domain. While the :confval:`primary_domain` selects a
- global default, this only has an effect within the same file.
-
-If no other default is selected, the Python domain (named ``py``) is the
-default one, mostly for compatibility with documentation written for older
-versions of Sphinx.
-
-Directives and roles that belong to the default domain can be mentioned without
-giving the domain name, i.e. ::
-
- .. function:: pyfunc()
-
- Describes a Python function.
-
- Reference to :func:`pyfunc`.
-
-Cross-referencing syntax
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-For cross-reference roles provided by domains, the same facilities exist as for
-general cross-references. See :ref:`xref-syntax`.
-
-In short:
-
-* You may supply an explicit title and reference target: ``:role:`title
- <target>``` will refer to *target*, but the link text will be *title*.
-
-* If you prefix the content with ``!``, no reference/hyperlink will be created.
-
-* If you prefix the content with ``~``, the link text will only be the last
- component of the target. For example, ``:py:meth:`~Queue.Queue.get``` will
- refer to ``Queue.Queue.get`` but only display ``get`` as the link text.
-
-.. _python-domain:
-
-The Python Domain
------------------
-
-The Python domain (name **py**) provides the following directives for module
-declarations:
-
-.. rst:directive:: .. py:module:: name
-
- This directive marks the beginning of the description of a module (or package
- submodule, in which case the name should be fully qualified, including the
- package name). A description of the module such as the docstring can be
- placed in the body of the directive.
-
- This directive will also cause an entry in the global module index.
-
- .. versionchanged:: 5.2
-
- Module directives support body content.
-
- .. rubric:: options
-
- .. rst:directive:option:: platform: platforms
- :type: comma separated list
-
- Indicate platforms which the module is available (if it is available on
- all platforms, the option should be omitted). The keys are short
- identifiers; examples that are in use include "IRIX", "Mac", "Windows"
- and "Unix". It is important to use a key which has already been used when
- applicable.
-
- .. rst:directive:option:: synopsis: purpose
- :type: text
-
- Consist of one sentence describing the module's purpose -- it is currently
- only used in the Global Module Index.
-
- .. rst:directive:option:: deprecated
- :type: no argument
-
- Mark a module as deprecated; it will be designated as such in various
- locations then.
-
-
-
-.. rst:directive:: .. py:currentmodule:: name
-
- This directive tells Sphinx that the classes, functions etc. documented from
- here are in the given module (like :rst:dir:`py:module`), but it will not
- create index entries, an entry in the Global Module Index, or a link target
- for :rst:role:`py:mod`. This is helpful in situations where documentation
- for things in a module is spread over multiple files or sections -- one
- location has the :rst:dir:`py:module` directive, the others only
- :rst:dir:`py:currentmodule`.
-
-The following directives are provided for module and class contents:
-
-.. rst:directive:: .. py:function:: name(parameters)
- .. py:function:: name[type parameters](parameters)
-
- Describes a module-level function.
- The signature should include the parameters,
- together with optional type parameters,
- as given in the Python function definition, see :ref:`signatures`.
- For example::
-
- .. py:function:: Timer.repeat(repeat=3, number=1_000_000)
- .. py:function:: add[T](a: T, b: T) -> T
-
- For methods you should use :rst:dir:`py:method`.
-
- The description normally includes information about the parameters required
- and how they are used (especially whether mutable objects passed as
- parameters are modified), side effects, and possible exceptions.
-
- This information can (in any ``py`` directive) optionally be given in a
- structured form, see :ref:`info-field-lists`.
-
- .. rubric:: options
-
- .. rst:directive:option:: async
- :type: no value
-
- Indicate the function is an async function.
-
- .. versionadded:: 2.1
-
- .. rst:directive:option:: canonical
- :type: full qualified name including module name
-
- Describe the location where the object is defined if the object is
- imported from other modules
-
- .. versionadded:: 4.0
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's arguments will be emitted on a single logical
- line, overriding :confval:`python_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
- .. rst:directive:option:: single-line-type-parameter-list
- :type: no value
-
- Ensure that the function's type parameters are emitted on a single
- logical line, overriding :confval:`python_maximum_signature_line_length`
- and :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-
-.. rst:directive:: .. py:data:: name
-
- Describes global data in a module, including both variables and values used
- as "defined constants." Class and object attributes are not documented
- using this environment.
-
- .. rubric:: options
-
- .. rst:directive:option:: type: type of the variable
- :type: text
-
- .. versionadded:: 2.4
-
- .. rst:directive:option:: value: initial value of the variable
- :type: text
-
- .. versionadded:: 2.4
-
- .. rst:directive:option:: canonical
- :type: full qualified name including module name
-
- Describe the location where the object is defined if the object is
- imported from other modules
-
- .. versionadded:: 4.0
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
-.. rst:directive:: .. py:exception:: name
- .. py:exception:: name(parameters)
- .. py:exception:: name[type parmeters](parameters)
-
- Describes an exception class.
- The signature can, but need not include parentheses with constructor arguments,
- or may optionally include type parameters (see :pep:`695`).
-
- .. rubric:: options
-
- .. rst:directive:option:: final
- :type: no value
-
- Indicate the class is a final class.
-
- .. versionadded:: 3.1
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- See :rst:dir:`py:class:single-line-parameter-list`.
-
- .. versionadded:: 7.1
-
- .. rst:directive:option:: single-line-type-parameter-list
- :type: no value
-
- See :rst:dir:`py:class:single-line-type-parameter-list`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. py:class:: name
- .. py:class:: name(parameters)
- .. py:class:: name[type parmeters](parameters)
-
- Describes a class.
- The signature can optionally include type parameters (see :pep:`695`)
- or parentheses with parameters which will be shown as the constructor arguments.
- See also :ref:`signatures`.
-
- Methods and attributes belonging to the class should be placed in this
- directive's body. If they are placed outside, the supplied name should
- contain the class name so that cross-references still work. Example::
-
- .. py:class:: Foo
-
- .. py:method:: quux()
-
- -- or --
-
- .. py:class:: Bar
-
- .. py:method:: Bar.quux()
-
- The first way is the preferred one.
-
- .. rubric:: options
-
- .. rst:directive:option:: canonical
- :type: full qualified name including module name
-
- Describe the location where the object is defined if the object is
- imported from other modules
-
- .. versionadded:: 4.0
-
- .. rst:directive:option:: final
- :type: no value
-
- Indicate the class is a final class.
-
- .. versionadded:: 3.1
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the class constructor's arguments will be emitted on a single
- logical line, overriding :confval:`python_maximum_signature_line_length`
- and :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
- .. rst:directive:option:: single-line-type-parameter-list
- :type: no value
-
- Ensure that the class type parameters are emitted on a single logical
- line, overriding :confval:`python_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
-.. rst:directive:: .. py:attribute:: name
-
- Describes an object data attribute. The description should include
- information about the type of the data to be expected and whether it may be
- changed directly.
-
- .. rubric:: options
-
- .. rst:directive:option:: type: type of the attribute
- :type: text
-
- .. versionadded:: 2.4
-
- .. rst:directive:option:: value: initial value of the attribute
- :type: text
-
- .. versionadded:: 2.4
-
- .. rst:directive:option:: canonical
- :type: full qualified name including module name
-
- Describe the location where the object is defined if the object is
- imported from other modules
-
- .. versionadded:: 4.0
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
-.. rst:directive:: .. py:property:: name
-
- Describes an object property.
-
- .. versionadded:: 4.0
-
- .. rubric:: options
-
- .. rst:directive:option:: abstractmethod
- :type: no value
-
- Indicate the property is abstract.
-
- .. rst:directive:option:: classmethod
- :type: no value
-
- Indicate the property is a classmethod.
-
- .. versionaddedd: 4.2
-
- .. rst:directive:option:: type: type of the property
- :type: text
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
-.. rst:directive:: .. py:method:: name(parameters)
- .. py:method:: name[type parameters](parameters)
-
- Describes an object method. The parameters should not include the ``self``
- parameter. The description should include similar information to that
- described for ``function``. See also :ref:`signatures` and
- :ref:`info-field-lists`.
-
- .. rubric:: options
-
- .. rst:directive:option:: abstractmethod
- :type: no value
-
- Indicate the method is an abstract method.
-
- .. versionadded:: 2.1
-
- .. rst:directive:option:: async
- :type: no value
-
- Indicate the method is an async method.
-
- .. versionadded:: 2.1
-
- .. rst:directive:option:: canonical
- :type: full qualified name including module name
-
- Describe the location where the object is defined if the object is
- imported from other modules
-
- .. versionadded:: 4.0
-
- .. rst:directive:option:: classmethod
- :type: no value
-
- Indicate the method is a class method.
-
- .. versionadded:: 2.1
-
- .. rst:directive:option:: final
- :type: no value
-
- Indicate the class is a final method.
-
- .. versionadded:: 3.1
-
- .. rst::directive:option:: module
- :type: text
-
- Describe the location where the object is defined. The default value is
- the module specified by :rst:dir:`py:currentmodule`.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the method's arguments will be emitted on a single logical
- line, overriding :confval:`python_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
- .. rst:directive:option:: single-line-type-parameter-list
- :type: no value
-
- Ensure that the method's type parameters are emitted on a single logical
- line, overriding :confval:`python_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.2
-
- .. rst:directive:option:: staticmethod
- :type: no value
-
- Indicate the method is a static method.
-
- .. versionadded:: 2.1
-
-
-.. rst:directive:: .. py:staticmethod:: name(parameters)
- .. py:staticmethod:: name[type parameters](parameters)
-
- Like :rst:dir:`py:method`, but indicates that the method is a static method.
-
- .. versionadded:: 0.4
-
-.. rst:directive:: .. py:classmethod:: name(parameters)
- .. py:classmethod:: name[type parameters](parameters)
-
- Like :rst:dir:`py:method`, but indicates that the method is a class method.
-
- .. versionadded:: 0.6
-
-.. rst:directive:: .. py:decorator:: name
- .. py:decorator:: name(parameters)
- .. py:decorator:: name[type parameters](parameters)
-
- Describes a decorator function. The signature should represent the usage as
- a decorator. For example, given the functions
-
- .. code-block:: python
-
- def removename(func):
- func.__name__ = ''
- return func
-
- def setnewname(name):
- def decorator(func):
- func.__name__ = name
- return func
- return decorator
-
- the descriptions should look like this::
-
- .. py:decorator:: removename
-
- Remove name of the decorated function.
-
- .. py:decorator:: setnewname(name)
-
- Set name of the decorated function to *name*.
-
- (as opposed to ``.. py:decorator:: removename(func)``.)
-
- There is no ``py:deco`` role to link to a decorator that is marked up with
- this directive; rather, use the :rst:role:`py:func` role.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the decorator's arguments will be emitted on a single logical
- line, overriding :confval:`python_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
- .. rst:directive:option:: single-line-type-parameter-list
- :type: no value
-
- Ensure that the decorator's type parameters are emitted on a single
- logical line, overriding :confval:`python_maximum_signature_line_length`
- and :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.2
-
-.. rst:directive:: .. py:decoratormethod:: name
- .. py:decoratormethod:: name(signature)
- .. py:decoratormethod:: name[type parameters](signature)
-
- Same as :rst:dir:`py:decorator`, but for decorators that are methods.
-
- Refer to a decorator method using the :rst:role:`py:meth` role.
-
-.. _signatures:
-
-Python Signatures
-~~~~~~~~~~~~~~~~~
-
-Signatures of functions, methods and class constructors can be given like they
-would be written in Python.
-
-Default values for optional arguments can be given (but if they contain commas,
-they will confuse the signature parser). Python 3-style argument annotations
-can also be given as well as return type annotations::
-
- .. py:function:: compile(source : string, filename, symbol='file') -> ast object
-
-For functions with optional parameters that don't have default values
-(typically functions implemented in C extension modules without keyword
-argument support), you can use brackets to specify the optional parts:
-
-.. py:function:: compile(source[, filename[, symbol]])
- :no-index:
-
-It is customary to put the opening bracket before the comma.
-
-Python 3.12 introduced *type parameters*, which are type variables
-declared directly within the class or function definition:
-
-.. code:: python
-
- class AnimalList[AnimalT](list[AnimalT]):
- ...
-
- def add[T](a: T, b: T) -> T:
- return a + b
-
-The corresponding reStructuredText documentation would be:
-
-.. code:: rst
-
- .. py:class:: AnimalList[AnimalT]
-
- .. py:function:: add[T](a: T, b: T) -> T
-
-See :pep:`695` and :pep:`696` for details and the full specification.
-
-.. _info-field-lists:
-
-Info field lists
-~~~~~~~~~~~~~~~~
-
-.. versionadded:: 0.4
-.. versionchanged:: 3.0
-
- meta fields are added.
-
-Inside Python object description directives, reST field lists with these fields
-are recognized and formatted nicely:
-
-* ``param``, ``parameter``, ``arg``, ``argument``, ``key``, ``keyword``:
- Description of a parameter.
-* ``type``: Type of a parameter. Creates a link if possible.
-* ``raises``, ``raise``, ``except``, ``exception``: That (and when) a specific
- exception is raised.
-* ``var``, ``ivar``, ``cvar``: Description of a variable.
-* ``vartype``: Type of a variable. Creates a link if possible.
-* ``returns``, ``return``: Description of the return value.
-* ``rtype``: Return type. Creates a link if possible.
-* ``meta``: Add metadata to description of the python object. The metadata will
- not be shown on output document. For example, ``:meta private:`` indicates
- the python object is private member. It is used in
- :py:mod:`sphinx.ext.autodoc` for filtering members.
-
-.. note::
-
- In current release, all ``var``, ``ivar`` and ``cvar`` are represented as
- "Variable". There is no difference at all.
-
-The field names must consist of one of these keywords and an argument (except
-for ``returns`` and ``rtype``, which do not need an argument). This is best
-explained by an example::
-
- .. py:function:: send_message(sender, recipient, message_body, [priority=1])
-
- Send a message to a recipient
-
- :param str sender: The person sending the message
- :param str recipient: The recipient of the message
- :param str message_body: The body of the message
- :param priority: The priority of the message, can be a number 1-5
- :type priority: integer or None
- :return: the message id
- :rtype: int
- :raises ValueError: if the message_body exceeds 160 characters
- :raises TypeError: if the message_body is not a basestring
-
-This will render like this:
-
-.. py:function:: send_message(sender, recipient, message_body, [priority=1])
- :no-index:
-
- Send a message to a recipient
-
- :param str sender: The person sending the message
- :param str recipient: The recipient of the message
- :param str message_body: The body of the message
- :param priority: The priority of the message, can be a number 1-5
- :type priority: int or None
- :return: the message id
- :rtype: int
- :raises ValueError: if the message_body exceeds 160 characters
- :raises TypeError: if the message_body is not a basestring
-
-It is also possible to combine parameter type and description, if the type is a
-single word, like this::
-
- :param int priority: The priority of the message, can be a number 1-5
-
-.. versionadded:: 1.5
-
-Container types such as lists and dictionaries can be linked automatically
-using the following syntax::
-
- :type priorities: list(int)
- :type priorities: list[int]
- :type mapping: dict(str, int)
- :type mapping: dict[str, int]
- :type point: tuple(float, float)
- :type point: tuple[float, float]
-
-Multiple types in a type field will be linked automatically if separated by the
-word "or"::
-
- :type an_arg: int or None
- :vartype a_var: str or int
- :rtype: float or str
-
-.. _python-roles:
-
-Cross-referencing Python objects
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The following roles refer to objects in modules and are possibly hyperlinked if
-a matching identifier is found:
-
-.. rst:role:: py:mod
-
- Reference a module; a dotted name may be used. This should also be used for
- package names.
-
-.. rst:role:: py:func
-
- Reference a Python function; dotted names may be used. The role text needs
- not include trailing parentheses to enhance readability; they will be added
- automatically by Sphinx if the :confval:`add_function_parentheses` config
- value is ``True`` (the default).
-
-.. rst:role:: py:data
-
- Reference a module-level variable.
-
-.. rst:role:: py:const
-
- Reference a "defined" constant. This may be a Python variable that is not
- intended to be changed.
-
-.. rst:role:: py:class
-
- Reference a class; a dotted name may be used.
-
-.. rst:role:: py:meth
-
- Reference a method of an object. The role text can include the type name
- and the method name; if it occurs within the description of a type, the type
- name can be omitted. A dotted name may be used.
-
-.. rst:role:: py:attr
-
- Reference a data attribute of an object.
-
- .. note:: The role is also able to refer to property.
-
-.. rst:role:: py:exc
-
- Reference an exception. A dotted name may be used.
-
-.. rst:role:: py:obj
-
- Reference an object of unspecified type. Useful e.g. as the
- :confval:`default_role`.
-
- .. versionadded:: 0.4
-
-The name enclosed in this markup can include a module name and/or a class name.
-For example, ``:py:func:`filter``` could refer to a function named ``filter``
-in the current module, or the built-in function of that name. In contrast,
-``:py:func:`foo.filter``` clearly refers to the ``filter`` function in the
-``foo`` module.
-
-Normally, names in these roles are searched first without any further
-qualification, then with the current module name prepended, then with the
-current module and class name (if any) prepended. If you prefix the name with
-a dot, this order is reversed. For example, in the documentation of Python's
-:mod:`codecs` module, ``:py:func:`open``` always refers to the built-in
-function, while ``:py:func:`.open``` refers to :func:`codecs.open`.
-
-A similar heuristic is used to determine whether the name is an attribute of
-the currently documented class.
-
-Also, if the name is prefixed with a dot, and no exact match is found, the
-target is taken as a suffix and all object names with that suffix are searched.
-For example, ``:py:meth:`.TarFile.close``` references the
-``tarfile.TarFile.close()`` function, even if the current module is not
-``tarfile``. Since this can get ambiguous, if there is more than one possible
-match, you will get a warning from Sphinx.
-
-Note that you can combine the ``~`` and ``.`` prefixes:
-``:py:meth:`~.TarFile.close``` will reference the ``tarfile.TarFile.close()``
-method, but the visible link caption will only be ``close()``.
-
-
-.. _c-domain:
-
-The C Domain
-------------
-
-The C domain (name **c**) is suited for documentation of C API.
-
-.. rst:directive:: .. c:member:: declaration
- .. c:var:: declaration
-
- Describes a C struct member or variable. Example signature::
-
- .. c:member:: PyObject *PyTypeObject.tp_bases
-
- The difference between the two directives is only cosmetic.
-
-.. rst:directive:: .. c:function:: function prototype
-
- Describes a C function. The signature should be given as in C, e.g.::
-
- .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
-
- Note that you don't have to backslash-escape asterisks in the signature, as
- it is not parsed by the reST inliner.
-
- In the description of a function you can use the following info fields
- (see also :ref:`info-field-lists`).
-
- * ``param``, ``parameter``, ``arg``, ``argument``,
- Description of a parameter.
- * ``type``: Type of a parameter,
- written as if passed to the :rst:role:`c:expr` role.
- * ``returns``, ``return``: Description of the return value.
- * ``rtype``: Return type,
- written as if passed to the :rst:role:`c:expr` role.
- * ``retval``, ``retvals``: An alternative to ``returns`` for describing
- the result of the function.
-
- .. versionadded:: 4.3
- The ``retval`` field type.
-
- For example::
-
- .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
-
- :param type: description of the first parameter.
- :param nitems: description of the second parameter.
- :returns: a result.
- :retval NULL: under some conditions.
- :retval NULL: under some other conditions as well.
-
- which renders as
-
- .. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
-
- ..
- ** for some editors (e.g., vim) to stop bold-highlighting the source
-
- :param type: description of the first parameter.
- :param nitems: description of the second parameter.
- :returns: a result.
- :retval NULL: under some conditions.
- :retval NULL: under some other conditions as well.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's parameters will be emitted on a single logical
- line, overriding :confval:`c_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-
-.. rst:directive:: .. c:macro:: name
- .. c:macro:: name(arg list)
-
- Describes a C macro, i.e., a C-language ``#define``, without the replacement
- text.
-
- In the description of a macro you can use the same info fields as for the
- :rst:dir:`c:function` directive.
-
- .. versionadded:: 3.0
- The function style variant.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the macro's parameters will be emitted on a single logical
- line, overriding :confval:`c_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. c:struct:: name
-
- Describes a C struct.
-
- .. versionadded:: 3.0
-
-.. rst:directive:: .. c:union:: name
-
- Describes a C union.
-
- .. versionadded:: 3.0
-
-.. rst:directive:: .. c:enum:: name
-
- Describes a C enum.
-
- .. versionadded:: 3.0
-
-.. rst:directive:: .. c:enumerator:: name
-
- Describes a C enumerator.
-
- .. versionadded:: 3.0
-
-.. rst:directive:: .. c:type:: typedef-like declaration
- .. c:type:: name
-
- Describes a C type, either as a typedef, or the alias for an unspecified
- type.
-
-.. _c-roles:
-
-Cross-referencing C constructs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The following roles create cross-references to C-language constructs if they
-are defined in the documentation:
-
-.. rst:role:: c:member
- c:data
- c:var
- c:func
- c:macro
- c:struct
- c:union
- c:enum
- c:enumerator
- c:type
-
- Reference a C declaration, as defined above.
- Note that :rst:role:`c:member`, :rst:role:`c:data`, and
- :rst:role:`c:var` are equivalent.
-
- .. versionadded:: 3.0
- The var, struct, union, enum, and enumerator roles.
-
-
-Anonymous Entities
-~~~~~~~~~~~~~~~~~~
-
-C supports anonymous structs, enums, and unions.
-For the sake of documentation they must be given some name that starts with
-``@``, e.g., ``@42`` or ``@data``.
-These names can also be used in cross-references,
-though nested symbols will be found even when omitted.
-The ``@...`` name will always be rendered as **[anonymous]** (possibly as a
-link).
-
-Example::
-
- .. c:struct:: Data
-
- .. c:union:: @data
-
- .. c:var:: int a
-
- .. c:var:: double b
-
- Explicit ref: :c:var:`Data.@data.a`. Short-hand ref: :c:var:`Data.a`.
-
-This will be rendered as:
-
-.. c:struct:: Data
- :no-contents-entry:
- :no-index-entry:
-
- .. c:union:: @data
- :no-contents-entry:
- :no-index-entry:
-
- .. c:var:: int a
- :no-contents-entry:
- :no-index-entry:
-
- .. c:var:: double b
- :no-contents-entry:
- :no-index-entry:
-
-Explicit ref: :c:var:`Data.@data.a`. Short-hand ref: :c:var:`Data.a`.
-
-.. versionadded:: 3.0
-
-
-Aliasing Declarations
-~~~~~~~~~~~~~~~~~~~~~
-
-.. c:namespace-push:: @alias
-
-Sometimes it may be helpful list declarations elsewhere than their main
-documentation, e.g., when creating a synopsis of an interface.
-The following directive can be used for this purpose.
-
-.. rst:directive:: .. c:alias:: name
-
- Insert one or more alias declarations. Each entity can be specified
- as they can in the :rst:role:`c:any` role.
-
- For example::
-
- .. c:var:: int data
- .. c:function:: int f(double k)
-
- .. c:alias:: data
- f
-
- becomes
-
- .. c:var:: int data
- .. c:function:: int f(double k)
-
- .. c:alias:: data
- f
-
- .. versionadded:: 3.2
-
-
- .. rubric:: Options
-
- .. rst:directive:option:: maxdepth: int
-
- Insert nested declarations as well, up to the total depth given.
- Use 0 for infinite depth and 1 for just the mentioned declaration.
- Defaults to 1.
-
- .. versionadded:: 3.3
-
- .. rst:directive:option:: noroot
-
- Skip the mentioned declarations and only render nested declarations.
- Requires ``maxdepth`` either 0 or at least 2.
-
- .. versionadded:: 3.5
-
-
-.. c:namespace-pop::
-
-
-Inline Expressions and Types
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. rst:role:: c:expr
- c:texpr
-
- Insert a C expression or type either as inline code (``cpp:expr``)
- or inline text (``cpp:texpr``). For example::
-
- .. c:var:: int a = 42
-
- .. c:function:: int f(int i)
-
- An expression: :c:expr:`a * f(a)` (or as text: :c:texpr:`a * f(a)`).
-
- A type: :c:expr:`const Data*`
- (or as text :c:texpr:`const Data*`).
-
- will be rendered as follows:
-
- .. c:var:: int a = 42
- :no-contents-entry:
- :no-index-entry:
-
- .. c:function:: int f(int i)
- :no-contents-entry:
- :no-index-entry:
-
- An expression: :c:expr:`a * f(a)` (or as text: :c:texpr:`a * f(a)`).
-
- A type: :c:expr:`const Data*`
- (or as text :c:texpr:`const Data*`).
-
- .. versionadded:: 3.0
-
-
-Namespacing
-~~~~~~~~~~~
-
-.. versionadded:: 3.1
-
-The C language it self does not support namespacing, but it can sometimes be
-useful to emulate it in documentation, e.g., to show alternate declarations.
-The feature may also be used to document members of structs/unions/enums
-separate from their parent declaration.
-
-The current scope can be changed using three namespace directives. They manage
-a stack declarations where ``c:namespace`` resets the stack and changes a given
-scope.
-
-The ``c:namespace-push`` directive changes the scope to a given inner scope
-of the current one.
-
-The ``c:namespace-pop`` directive undoes the most recent
-``c:namespace-push`` directive.
-
-.. rst:directive:: .. c:namespace:: scope specification
-
- Changes the current scope for the subsequent objects to the given scope, and
- resets the namespace directive stack. Note that nested scopes can be
- specified by separating with a dot, e.g.::
-
- .. c:namespace:: Namespace1.Namespace2.SomeStruct.AnInnerStruct
-
- All subsequent objects will be defined as if their name were declared with
- the scope prepended. The subsequent cross-references will be searched for
- starting in the current scope.
-
- Using ``NULL`` or ``0`` as the scope will change to global scope.
-
-.. rst:directive:: .. c:namespace-push:: scope specification
-
- Change the scope relatively to the current scope. For example, after::
-
- .. c:namespace:: A.B
-
- .. c:namespace-push:: C.D
-
- the current scope will be ``A.B.C.D``.
-
-.. rst:directive:: .. c:namespace-pop::
-
- Undo the previous ``c:namespace-push`` directive (*not* just pop a scope).
- For example, after::
-
- .. c:namespace:: A.B
-
- .. c:namespace-push:: C.D
-
- .. c:namespace-pop::
-
- the current scope will be ``A.B`` (*not* ``A.B.C``).
-
- If no previous ``c:namespace-push`` directive has been used, but only a
- ``c:namespace`` directive, then the current scope will be reset to global
- scope. That is, ``.. c:namespace:: A.B`` is equivalent to::
-
- .. c:namespace:: NULL
-
- .. c:namespace-push:: A.B
-
-Configuration Variables
-~~~~~~~~~~~~~~~~~~~~~~~
-
-See :ref:`c-config`.
-
-
-.. _cpp-domain:
-
-The C++ Domain
---------------
-
-The C++ domain (name **cpp**) supports documenting C++ projects.
-
-Directives for Declaring Entities
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The following directives are available. All declarations can start with a
-visibility statement (``public``, ``private`` or ``protected``).
-
-.. rst:directive:: .. cpp:class:: class specifier
- .. cpp:struct:: class specifier
-
- Describe a class/struct, possibly with specification of inheritance, e.g.,::
-
- .. cpp:class:: MyClass : public MyBase, MyOtherBase
-
- The difference between :rst:dir:`cpp:class` and :rst:dir:`cpp:struct` is
- only cosmetic: the prefix rendered in the output, and the specifier shown
- in the index.
-
- The class can be directly declared inside a nested scope, e.g.,::
-
- .. cpp:class:: OuterScope::MyClass : public MyBase, MyOtherBase
-
- A class template can be declared::
-
- .. cpp:class:: template<typename T, std::size_t N> std::array
-
- or with a line break::
-
- .. cpp:class:: template<typename T, std::size_t N> \
- std::array
-
- Full and partial template specialisations can be declared::
-
- .. cpp:class:: template<> \
- std::array<bool, 256>
-
- .. cpp:class:: template<typename T> \
- std::array<T, 42>
-
- .. versionadded:: 2.0
- The :rst:dir:`cpp:struct` directive.
-
-.. rst:directive:: .. cpp:function:: (member) function prototype
-
- Describe a function or member function, e.g.,::
-
- .. cpp:function:: bool myMethod(int arg1, std::string arg2)
-
- A function with parameters and types.
-
- .. cpp:function:: bool myMethod(int, double)
-
- A function with unnamed parameters.
-
- .. cpp:function:: const T &MyClass::operator[](std::size_t i) const
-
- An overload for the indexing operator.
-
- .. cpp:function:: operator bool() const
-
- A casting operator.
-
- .. cpp:function:: constexpr void foo(std::string &bar[2]) noexcept
-
- A constexpr function.
-
- .. cpp:function:: MyClass::MyClass(const MyClass&) = default
-
- A copy constructor with default implementation.
-
- Function templates can also be described::
-
- .. cpp:function:: template<typename U> \
- void print(U &&u)
-
- and function template specialisations::
-
- .. cpp:function:: template<> \
- void print(int i)
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's parameters will be emitted on a single logical
- line, overriding :confval:`cpp_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. cpp:member:: (member) variable declaration
- .. cpp:var:: (member) variable declaration
-
- Describe a variable or member variable, e.g.,::
-
- .. cpp:member:: std::string MyClass::myMember
-
- .. cpp:var:: std::string MyClass::myOtherMember[N][M]
-
- .. cpp:member:: int a = 42
-
- Variable templates can also be described::
-
- .. cpp:member:: template<class T> \
- constexpr T pi = T(3.1415926535897932385)
-
-.. rst:directive:: .. cpp:type:: typedef declaration
- .. cpp:type:: name
- .. cpp:type:: type alias declaration
-
- Describe a type as in a typedef declaration, a type alias declaration, or
- simply the name of a type with unspecified type, e.g.,::
-
- .. cpp:type:: std::vector<int> MyList
-
- A typedef-like declaration of a type.
-
- .. cpp:type:: MyContainer::const_iterator
-
- Declaration of a type alias with unspecified type.
-
- .. cpp:type:: MyType = std::unordered_map<int, std::string>
-
- Declaration of a type alias.
-
- A type alias can also be templated::
-
- .. cpp:type:: template<typename T> \
- MyContainer = std::vector<T>
-
- The example are rendered as follows.
-
- .. cpp:type:: std::vector<int> MyList
- :no-contents-entry:
- :no-index-entry:
-
- A typedef-like declaration of a type.
-
- .. cpp:type:: MyContainer::const_iterator
- :no-contents-entry:
- :no-index-entry:
-
- Declaration of a type alias with unspecified type.
-
- .. cpp:type:: MyType = std::unordered_map<int, std::string>
- :no-contents-entry:
- :no-index-entry:
-
- Declaration of a type alias.
-
- .. cpp:type:: template<typename T> \
- MyContainer = std::vector<T>
- :no-contents-entry:
- :no-index-entry:
-
-.. rst:directive:: .. cpp:enum:: unscoped enum declaration
- .. cpp:enum-struct:: scoped enum declaration
- .. cpp:enum-class:: scoped enum declaration
-
- Describe a (scoped) enum, possibly with the underlying type specified. Any
- enumerators declared inside an unscoped enum will be declared both in the
- enum scope and in the parent scope. Examples::
-
- .. cpp:enum:: MyEnum
-
- An unscoped enum.
-
- .. cpp:enum:: MySpecificEnum : long
-
- An unscoped enum with specified underlying type.
-
- .. cpp:enum-class:: MyScopedEnum
-
- A scoped enum.
-
- .. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type<MySpecificEnum>::type
-
- A scoped enum with non-default visibility, and with a specified
- underlying type.
-
-.. rst:directive:: .. cpp:enumerator:: name
- .. cpp:enumerator:: name = constant
-
- Describe an enumerator, optionally with its value defined, e.g.,::
-
- .. cpp:enumerator:: MyEnum::myEnumerator
-
- .. cpp:enumerator:: MyEnum::myOtherEnumerator = 42
-
-.. rst:directive:: .. cpp:union:: name
-
- Describe a union.
-
- .. versionadded:: 1.8
-
-.. rst:directive:: .. cpp:concept:: template-parameter-list name
-
- .. warning:: The support for concepts is experimental. It is based on the
- current draft standard and the Concepts Technical Specification.
- The features may change as they evolve.
-
- Describe a concept. It must have exactly 1 template parameter list. The name
- may be a nested name. Example::
-
- .. cpp:concept:: template<typename It> std::Iterator
-
- Proxy to an element of a notional sequence that can be compared,
- indirected, or incremented.
-
- **Notation**
-
- .. cpp:var:: It r
-
- An lvalue.
-
- **Valid Expressions**
-
- - :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
- - :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when
- :cpp:expr:`r` is incrementable.
-
- This will render as follows:
-
- .. cpp:concept:: template<typename It> std::Iterator
-
- Proxy to an element of a notional sequence that can be compared,
- indirected, or incremented.
-
- **Notation**
-
- .. cpp:var:: It r
-
- An lvalue.
-
- **Valid Expressions**
-
- - :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
- - :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r`
- is incrementable.
-
- .. versionadded:: 1.5
-
-
-Options
-^^^^^^^
-
-Some directives support options:
-
-- ``:no-index-entry:`` and ``:no-contents-entry:``, see :ref:`basic-domain-markup`.
-- ``:tparam-line-spec:``, for templated declarations.
- If specified, each template parameter will be rendered on a separate line.
-
- .. versionadded:: 1.6
-
-Anonymous Entities
-~~~~~~~~~~~~~~~~~~
-
-C++ supports anonymous namespaces, classes, enums, and unions.
-For the sake of documentation they must be given some name that starts with
-``@``, e.g., ``@42`` or ``@data``.
-These names can also be used in cross-references and (type) expressions,
-though nested symbols will be found even when omitted.
-The ``@...`` name will always be rendered as **[anonymous]** (possibly as a
-link).
-
-Example::
-
- .. cpp:class:: Data
-
- .. cpp:union:: @data
-
- .. cpp:var:: int a
-
- .. cpp:var:: double b
-
- Explicit ref: :cpp:var:`Data::@data::a`. Short-hand ref: :cpp:var:`Data::a`.
-
-This will be rendered as:
-
-.. cpp:class:: Data
- :no-contents-entry:
- :no-index-entry:
-
- .. cpp:union:: @data
- :no-contents-entry:
- :no-index-entry:
-
- .. cpp:var:: int a
- :no-contents-entry:
- :no-index-entry:
-
- .. cpp:var:: double b
- :no-contents-entry:
- :no-index-entry:
-
-Explicit ref: :cpp:var:`Data::@data::a`. Short-hand ref: :cpp:var:`Data::a`.
-
-.. versionadded:: 1.8
-
-
-Aliasing Declarations
-~~~~~~~~~~~~~~~~~~~~~
-
-Sometimes it may be helpful list declarations elsewhere than their main
-documentation, e.g., when creating a synopsis of a class interface.
-The following directive can be used for this purpose.
-
-.. rst:directive:: .. cpp:alias:: name or function signature
-
- Insert one or more alias declarations. Each entity can be specified
- as they can in the :rst:role:`cpp:any` role.
- If the name of a function is given (as opposed to the complete signature),
- then all overloads of the function will be listed.
-
- For example::
-
- .. cpp:alias:: Data::a
- overload_example::C::f
-
- becomes
-
- .. cpp:alias:: Data::a
- overload_example::C::f
-
- whereas::
-
- .. cpp:alias:: void overload_example::C::f(double d) const
- void overload_example::C::f(double d)
-
- becomes
-
- .. cpp:alias:: void overload_example::C::f(double d) const
- void overload_example::C::f(double d)
-
- .. versionadded:: 2.0
-
-
- .. rubric:: Options
-
- .. rst:directive:option:: maxdepth: int
-
- Insert nested declarations as well, up to the total depth given.
- Use 0 for infinite depth and 1 for just the mentioned declaration.
- Defaults to 1.
-
- .. versionadded:: 3.5
-
- .. rst:directive:option:: noroot
-
- Skip the mentioned declarations and only render nested declarations.
- Requires ``maxdepth`` either 0 or at least 2.
-
- .. versionadded:: 3.5
-
-
-Constrained Templates
-~~~~~~~~~~~~~~~~~~~~~
-
-.. warning:: The support for concepts is experimental. It is based on the
- current draft standard and the Concepts Technical Specification.
- The features may change as they evolve.
-
-.. note:: Sphinx does not currently support ``requires`` clauses.
-
-Placeholders
-^^^^^^^^^^^^
-
-Declarations may use the name of a concept to introduce constrained template
-parameters, or the keyword ``auto`` to introduce unconstrained template
-parameters::
-
- .. cpp:function:: void f(auto &&arg)
-
- A function template with a single unconstrained template parameter.
-
- .. cpp:function:: void f(std::Iterator it)
-
- A function template with a single template parameter, constrained by the
- Iterator concept.
-
-Template Introductions
-^^^^^^^^^^^^^^^^^^^^^^
-
-Simple constrained function or class templates can be declared with a `template
-introduction` instead of a template parameter list::
-
- .. cpp:function:: std::Iterator{It} void advance(It &it)
-
- A function template with a template parameter constrained to be an
- Iterator.
-
- .. cpp:class:: std::LessThanComparable{T} MySortedContainer
-
- A class template with a template parameter constrained to be
- LessThanComparable.
-
-They are rendered as follows.
-
-.. cpp:function:: std::Iterator{It} void advance(It &it)
- :no-contents-entry:
- :no-index-entry:
-
- A function template with a template parameter constrained to be an Iterator.
-
-.. cpp:class:: std::LessThanComparable{T} MySortedContainer
- :no-contents-entry:
- :no-index-entry:
-
- A class template with a template parameter constrained to be
- LessThanComparable.
-
-Note however that no checking is performed with respect to parameter
-compatibility. E.g., ``Iterator{A, B, C}`` will be accepted as an introduction
-even though it would not be valid C++.
-
-Inline Expressions and Types
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-.. rst:role:: cpp:expr
- cpp:texpr
-
- Insert a C++ expression or type either as inline code (``cpp:expr``)
- or inline text (``cpp:texpr``). For example::
-
- .. cpp:var:: int a = 42
-
- .. cpp:function:: int f(int i)
-
- An expression: :cpp:expr:`a * f(a)` (or as text: :cpp:texpr:`a * f(a)`).
-
- A type: :cpp:expr:`const MySortedContainer<int>&`
- (or as text :cpp:texpr:`const MySortedContainer<int>&`).
-
- will be rendered as follows:
-
- .. cpp:var:: int a = 42
- :no-contents-entry:
- :no-index-entry:
-
- .. cpp:function:: int f(int i)
- :no-contents-entry:
- :no-index-entry:
-
- An expression: :cpp:expr:`a * f(a)` (or as text: :cpp:texpr:`a * f(a)`).
-
- A type: :cpp:expr:`const MySortedContainer<int>&`
- (or as text :cpp:texpr:`const MySortedContainer<int>&`).
-
- .. versionadded:: 1.7
- The :rst:role:`cpp:expr` role.
-
- .. versionadded:: 1.8
- The :rst:role:`cpp:texpr` role.
-
-Namespacing
-~~~~~~~~~~~
-
-Declarations in the C++ domain are as default placed in global scope. The
-current scope can be changed using three namespace directives. They manage a
-stack declarations where ``cpp:namespace`` resets the stack and changes a given
-scope.
-
-The ``cpp:namespace-push`` directive changes the scope to a given inner scope
-of the current one.
-
-The ``cpp:namespace-pop`` directive undoes the most recent
-``cpp:namespace-push`` directive.
-
-.. rst:directive:: .. cpp:namespace:: scope specification
-
- Changes the current scope for the subsequent objects to the given scope, and
- resets the namespace directive stack. Note that the namespace does not need
- to correspond to C++ namespaces, but can end in names of classes, e.g.,::
-
- .. cpp:namespace:: Namespace1::Namespace2::SomeClass::AnInnerClass
-
- All subsequent objects will be defined as if their name were declared with
- the scope prepended. The subsequent cross-references will be searched for
- starting in the current scope.
-
- Using ``NULL``, ``0``, or ``nullptr`` as the scope will change to global
- scope.
-
- A namespace declaration can also be templated, e.g.,::
-
- .. cpp:class:: template<typename T> \
- std::vector
-
- .. cpp:namespace:: template<typename T> std::vector
-
- .. cpp:function:: std::size_t size() const
-
- declares ``size`` as a member function of the class template
- ``std::vector``. Equivalently this could have been declared using::
-
- .. cpp:class:: template<typename T> \
- std::vector
-
- .. cpp:function:: std::size_t size() const
-
- or::
-
- .. cpp:class:: template<typename T> \
- std::vector
-
-.. rst:directive:: .. cpp:namespace-push:: scope specification
-
- Change the scope relatively to the current scope. For example, after::
-
- .. cpp:namespace:: A::B
-
- .. cpp:namespace-push:: C::D
-
- the current scope will be ``A::B::C::D``.
-
- .. versionadded:: 1.4
-
-.. rst:directive:: .. cpp:namespace-pop::
-
- Undo the previous ``cpp:namespace-push`` directive (*not* just pop a scope).
- For example, after::
-
- .. cpp:namespace:: A::B
-
- .. cpp:namespace-push:: C::D
-
- .. cpp:namespace-pop::
-
- the current scope will be ``A::B`` (*not* ``A::B::C``).
-
- If no previous ``cpp:namespace-push`` directive has been used, but only a
- ``cpp:namespace`` directive, then the current scope will be reset to global
- scope. That is, ``.. cpp:namespace:: A::B`` is equivalent to::
-
- .. cpp:namespace:: nullptr
-
- .. cpp:namespace-push:: A::B
-
- .. versionadded:: 1.4
-
-Info field lists
-~~~~~~~~~~~~~~~~~
-
-All the C++ directives for declaring entities support the following
-info fields (see also :ref:`info-field-lists`):
-
-* ``tparam``: Description of a template parameter.
-
-The :rst:dir:`cpp:function` directive additionally supports the
-following fields:
-
-* ``param``, ``parameter``, ``arg``, ``argument``: Description of a parameter.
-* ``returns``, ``return``: Description of a return value.
-* ``retval``, ``retvals``: An alternative to ``returns`` for describing
- the result of the function.
-* `throws`, `throw`, `exception`: Description of a possibly thrown exception.
-
-.. versionadded:: 4.3
- The ``retval`` field type.
-
-.. _cpp-roles:
-
-Cross-referencing
-~~~~~~~~~~~~~~~~~
-
-These roles link to the given declaration types:
-
-.. rst:role:: cpp:any
- cpp:class
- cpp:struct
- cpp:func
- cpp:member
- cpp:var
- cpp:type
- cpp:concept
- cpp:enum
- cpp:enumerator
-
- Reference a C++ declaration by name (see below for details). The name must
- be properly qualified relative to the position of the link.
-
- .. versionadded:: 2.0
- The :rst:role:`cpp:struct` role as alias for the :rst:role:`cpp:class`
- role.
-
-.. admonition:: Note on References with Templates Parameters/Arguments
-
- These roles follow the Sphinx :ref:`xref-syntax` rules. This means care must
- be taken when referencing a (partial) template specialization, e.g. if the
- link looks like this: ``:cpp:class:`MyClass<int>```.
- This is interpreted as a link to ``int`` with a title of ``MyClass``.
- In this case, escape the opening angle bracket with a backslash,
- like this: ``:cpp:class:`MyClass\<int>```.
-
- When a custom title is not needed it may be useful to use the roles for
- inline expressions, :rst:role:`cpp:expr` and :rst:role:`cpp:texpr`, where
- angle brackets do not need escaping.
-
-Declarations without template parameters and template arguments
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-For linking to non-templated declarations the name must be a nested name, e.g.,
-``f`` or ``MyClass::f``.
-
-
-Overloaded (member) functions
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-When a (member) function is referenced using just its name, the reference
-will point to an arbitrary matching overload.
-The :rst:role:`cpp:any` and :rst:role:`cpp:func` roles use an alternative
-format, which simply is a complete function declaration.
-This will resolve to the exact matching overload.
-As example, consider the following class declaration:
-
-.. cpp:namespace-push:: overload_example
-.. cpp:class:: C
-
- .. cpp:function:: void f(double d) const
- .. cpp:function:: void f(double d)
- .. cpp:function:: void f(int i)
- .. cpp:function:: void f()
-
-References using the :rst:role:`cpp:func` role:
-
-- Arbitrary overload: ``C::f``, :cpp:func:`C::f`
-- Also arbitrary overload: ``C::f()``, :cpp:func:`C::f()`
-- Specific overload: ``void C::f()``, :cpp:func:`void C::f()`
-- Specific overload: ``void C::f(int)``, :cpp:func:`void C::f(int)`
-- Specific overload: ``void C::f(double)``, :cpp:func:`void C::f(double)`
-- Specific overload: ``void C::f(double) const``,
- :cpp:func:`void C::f(double) const`
-
-Note that the :confval:`add_function_parentheses` configuration variable
-does not influence specific overload references.
-
-.. cpp:namespace-pop::
-
-
-Templated declarations
-^^^^^^^^^^^^^^^^^^^^^^
-
-Assume the following declarations.
-
-.. cpp:class:: Wrapper
-
- .. cpp:class:: template<typename TOuter> \
- Outer
-
- .. cpp:class:: template<typename TInner> \
- Inner
-
-In general the reference must include the template parameter declarations,
-and template arguments for the prefix of qualified names. For example:
-
-- ``template\<typename TOuter> Wrapper::Outer``
- (:cpp:class:`template\<typename TOuter> Wrapper::Outer`)
-- ``template\<typename TOuter> template\<typename TInner> Wrapper::Outer<TOuter>::Inner``
- (:cpp:class:`template\<typename TOuter> template\<typename TInner> Wrapper::Outer<TOuter>::Inner`)
-
-Currently the lookup only succeed if the template parameter identifiers are
-equal strings. That is, ``template\<typename UOuter> Wrapper::Outer`` will not
-work.
-
-As a shorthand notation, if a template parameter list is omitted,
-then the lookup will assume either a primary template or a non-template,
-but not a partial template specialisation.
-This means the following references work as well:
-
-- ``Wrapper::Outer``
- (:cpp:class:`Wrapper::Outer`)
-- ``Wrapper::Outer::Inner``
- (:cpp:class:`Wrapper::Outer::Inner`)
-- ``template\<typename TInner> Wrapper::Outer::Inner``
- (:cpp:class:`template\<typename TInner> Wrapper::Outer::Inner`)
-
-(Full) Template Specialisations
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Assume the following declarations.
-
-.. cpp:class:: template<typename TOuter> \
- Outer
-
- .. cpp:class:: template<typename TInner> \
- Inner
-
-.. cpp:class:: template<> \
- Outer<int>
-
- .. cpp:class:: template<typename TInner> \
- Inner
-
- .. cpp:class:: template<> \
- Inner<bool>
-
-In general the reference must include a template parameter list for each
-template argument list. The full specialisation above can therefore be
-referenced with ``template\<> Outer\<int>`` (:cpp:class:`template\<>
-Outer\<int>`) and ``template\<> template\<> Outer\<int>::Inner\<bool>``
-(:cpp:class:`template\<> template\<> Outer\<int>::Inner\<bool>`). As a
-shorthand the empty template parameter list can be omitted, e.g.,
-``Outer\<int>`` (:cpp:class:`Outer\<int>`) and ``Outer\<int>::Inner\<bool>``
-(:cpp:class:`Outer\<int>::Inner\<bool>`).
-
-Partial Template Specialisations
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Assume the following declaration.
-
-.. cpp:class:: template<typename T> \
- Outer<T*>
-
-References to partial specialisations must always include the template
-parameter lists, e.g., ``template\<typename T> Outer\<T*>``
-(:cpp:class:`template\<typename T> Outer\<T*>`). Currently the lookup only
-succeed if the template parameter identifiers are equal strings.
-
-Configuration Variables
-~~~~~~~~~~~~~~~~~~~~~~~
-
-See :ref:`cpp-config`.
-
-.. _domains-std:
-
-The Standard Domain
+MOVED: Basic Markup
-------------------
-The so-called "standard" domain collects all markup that doesn't warrant a
-domain of its own. Its directives and roles are not prefixed with a domain
-name.
-
-The standard domain is also where custom object descriptions, added using the
-:func:`~sphinx.application.Sphinx.add_object_type` API, are placed.
-
-There is a set of directives allowing documenting command-line programs:
-
-.. rst:directive:: .. option:: name args, name args, ...
-
- Describes a command line argument or switch. Option argument names should
- be enclosed in angle brackets. Examples::
-
- .. option:: dest_dir
-
- Destination directory.
-
- .. option:: -m <module>, --module <module>
-
- Run a module as a script.
-
- The directive will create cross-reference targets for the given options,
- referenceable by :rst:role:`option` (in the example case, you'd use something
- like ``:option:`dest_dir```, ``:option:`-m```, or ``:option:`--module```).
-
- .. versionchanged:: 5.3
-
- One can cross-reference including an option value: ``:option:`--module=foobar```,
- ,``:option:`--module[=foobar]``` or ``:option:`--module foobar```.
-
- Use :confval:`option_emphasise_placeholders` for parsing of
- "variable part" of a literal text (similarly to the :rst:role:`samp` role).
-
- ``cmdoption`` directive is a deprecated alias for the ``option`` directive.
-
-.. rst:directive:: .. envvar:: name
-
- Describes an environment variable that the documented code or program uses
- or defines. Referenceable by :rst:role:`envvar`.
-
-.. rst:directive:: .. program:: name
-
- Like :rst:dir:`py:currentmodule`, this directive produces no output.
- Instead, it serves to notify Sphinx that all following :rst:dir:`option`
- directives document options for the program called *name*.
-
- If you use :rst:dir:`program`, you have to qualify the references in your
- :rst:role:`option` roles by the program name, so if you have the following
- situation ::
-
- .. program:: rm
-
- .. option:: -r
-
- Work recursively.
-
- .. program:: svn
-
- .. option:: -r <revision>
-
- Specify the revision to work upon.
-
- then ``:option:`rm -r``` would refer to the first option, while
- ``:option:`svn -r``` would refer to the second one.
-
- If ``None`` is passed to the argument, the directive will reset the
- current program name.
-
- The program name may contain spaces (in case you want to document
- subcommands like ``svn add`` and ``svn commit`` separately).
-
- .. versionadded:: 0.5
-
-There is also a very generic object description directive, which is not tied to
-any domain:
-
-.. rst:directive:: .. describe:: text
- .. object:: text
-
- This directive produces the same formatting as the specific ones provided by
- domains, but does not create index entries or cross-referencing targets.
- Example::
-
- .. describe:: PAPER
-
- You can set this variable to select a paper size.
-
-
-The JavaScript Domain
----------------------
-
-The JavaScript domain (name **js**) provides the following directives:
-
-.. rst:directive:: .. js:module:: name
-
- This directive sets the module name for object declarations that follow
- after. The module name is used in the global module index and in cross
- references. This directive does not create an object heading like
- :rst:dir:`py:class` would, for example.
-
- By default, this directive will create a linkable entity and will cause an
- entry in the global module index, unless the ``no-index`` option is
- specified. If this option is specified, the directive will only update the
- current module name.
-
- .. versionadded:: 1.6
- .. versionchanged:: 5.2
-
- Module directives support body content.
-
-.. rst:directive:: .. js:function:: name(signature)
-
- Describes a JavaScript function or method. If you want to describe
- arguments as optional use square brackets as :ref:`documented <signatures>`
- for Python signatures.
-
- You can use fields to give more details about arguments and their expected
- types, errors which may be thrown by the function, and the value being
- returned::
-
- .. js:function:: $.getJSON(href, callback[, errback])
-
- :param string href: An URI to the location of the resource.
- :param callback: Gets called with the object.
- :param errback:
- Gets called in case the request fails. And a lot of other
- text so we need multiple lines.
- :throws SomeError: For whatever reason in that case.
- :returns: Something.
-
- This is rendered as:
-
- .. js:function:: $.getJSON(href, callback[, errback])
- :no-index:
-
- :param string href: An URI to the location of the resource.
- :param callback: Gets called with the object.
- :param errback:
- Gets called in case the request fails. And a lot of other
- text so we need multiple lines.
- :throws SomeError: For whatever reason in that case.
- :returns: Something.
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's parameters will be emitted on a single logical
- line, overriding :confval:`javascript_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. js:method:: name(signature)
-
- This directive is an alias for :rst:dir:`js:function`, however it describes
- a function that is implemented as a method on a class object.
-
- .. versionadded:: 1.6
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's parameters will be emitted on a single logical
- line, overriding :confval:`javascript_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. js:class:: name
-
- Describes a constructor that creates an object. This is basically like a
- function but will show up with a `class` prefix::
-
- .. js:class:: MyAnimal(name[, age])
-
- :param string name: The name of the animal
- :param number age: an optional age for the animal
-
- This is rendered as:
-
- .. js:class:: MyAnimal(name[, age])
- :no-index:
-
- :param string name: The name of the animal
- :param number age: an optional age for the animal
-
- .. rst:directive:option:: single-line-parameter-list
- :type: no value
-
- Ensures that the function's parameters will be emitted on a single logical
- line, overriding :confval:`javascript_maximum_signature_line_length` and
- :confval:`maximum_signature_line_length`.
-
- .. versionadded:: 7.1
-
-.. rst:directive:: .. js:data:: name
-
- Describes a global variable or constant.
-
-.. rst:directive:: .. js:attribute:: object.name
-
- Describes the attribute *name* of *object*.
-
-.. _js-roles:
-
-These roles are provided to refer to the described objects:
-
-.. rst:role:: js:mod
- js:func
- js:meth
- js:class
- js:data
- js:attr
-
-
-The reStructuredText domain
----------------------------
-
-The reStructuredText domain (name **rst**) provides the following directives:
-
-.. rst:directive:: .. rst:directive:: name
-
- Describes a reST directive. The *name* can be a single directive name or
- actual directive syntax (`..` prefix and `::` suffix) with arguments that
- will be rendered differently. For example::
-
- .. rst:directive:: foo
-
- Foo description.
-
- .. rst:directive:: .. bar:: baz
-
- Bar description.
-
- will be rendered as:
-
- .. rst:directive:: foo
- :no-index:
-
- Foo description.
-
- .. rst:directive:: .. bar:: baz
- :no-index:
-
- Bar description.
-
-.. rst:directive:: .. rst:directive:option:: name
-
- Describes an option for reST directive. The *name* can be a single option
- name or option name with arguments which separated with colon (``:``).
- For example::
-
- .. rst:directive:: toctree
-
- .. rst:directive:option:: caption: caption of ToC
-
- .. rst:directive:option:: glob
-
- will be rendered as:
-
- .. rst:directive:: toctree
- :no-index:
-
- .. rst:directive:option:: caption: caption of ToC
- :no-index:
-
- .. rst:directive:option:: glob
- :no-index:
-
- .. rubric:: options
-
- .. rst:directive:option:: type: description of argument
- :type: text
-
- Describe the type of option value.
-
- For example::
-
- .. rst:directive:: toctree
-
- .. rst:directive:option:: maxdepth
- :type: integer or no value
-
- .. versionadded:: 2.1
-
-.. rst:directive:: .. rst:role:: name
-
- Describes a reST role. For example::
-
- .. rst:role:: foo
-
- Foo description.
-
- will be rendered as:
-
- .. rst:role:: foo
- :no-index:
-
- Foo description.
-
-.. _rst-roles:
-
-These roles are provided to refer to the described objects:
-
-.. rst:role:: rst:dir
- rst:role
-
-.. _math-domain:
-
-The Math Domain
+.. raw:: html
+
+ <span id="basic-markup">
+ <span id="basic-domain-markup">
+ <span id="directive-default-domain">
+ <span id="cross-referencing-syntax">
+
+See :doc:`/usage/domains/index`.
+
+
+MOVED: Python Domain
+--------------------
+
+.. raw:: html
+
+ <span id="the-python-domain">
+ <span id="python-domain">
+ <span id="directive-py-module">
+ <span id="directive-option-py-module-platform">
+ <span id="directive-option-py-module-synopsis">
+ <span id="directive-option-py-module-deprecated">
+ <span id="directive-py-currentmodule">
+ <span id="directive-py-function">
+ <span id="directive-option-py-function-async">
+ <span id="directive-option-py-function-canonical">
+ <span id="directive-option-py-function-single-line-parameter-list">
+ <span id="directive-option-py-function-single-line-type-parameter-list">
+ <span id="directive-py-data">
+ <span id="directive-option-py-data-type">
+ <span id="directive-option-py-data-value">
+ <span id="directive-option-py-data-canonical">
+ <span id="directive-py-exception">
+ <span id="index-0">
+ <span id="directive-option-py-exception-final">
+ <span id="directive-option-py-exception-single-line-parameter-list">
+ <span id="directive-option-py-exception-single-line-type-parameter-list">
+ <span id="directive-py-class">
+ <span id="index-1">
+ <span id="directive-option-py-class-canonical">
+ <span id="directive-option-py-class-final">
+ <span id="directive-option-py-class-single-line-parameter-list">
+ <span id="directive-option-py-class-single-line-type-parameter-list">
+ <span id="directive-py-attribute">
+ <span id="directive-option-py-attribute-type">
+ <span id="directive-option-py-attribute-value">
+ <span id="directive-option-py-attribute-canonical">
+ <span id="directive-py-property">
+ <span id="directive-option-py-property-abstractmethod">
+ <span id="directive-option-py-property-classmethod">
+ <span id="directive-option-py-property-type">
+ <span id="directive-py-method">
+ <span id="directive-option-py-method-abstractmethod">
+ <span id="directive-option-py-method-async">
+ <span id="directive-option-py-method-canonical">
+ <span id="directive-option-py-method-classmethod">
+ <span id="directive-option-py-method-final">
+ <span id="directive-option-py-method-single-line-parameter-list">
+ <span id="directive-option-py-method-single-line-type-parameter-list">
+ <span id="directive-option-py-method-staticmethod">
+ <span id="directive-py-staticmethod">
+ <span id="directive-py-classmethod">
+ <span id="directive-py-decorator">
+ <span id="directive-option-py-decorator-single-line-parameter-list">
+ <span id="directive-option-py-decorator-single-line-type-parameter-list">
+ <span id="directive-py-decoratormethod">
+ <span id="python-signatures">
+ <span id="signatures">
+ <span id="index-2">
+ <span id="index-3">
+ <span id="info-field-lists">
+ <span id="id1">
+ <span id="cross-referencing-python-objects">
+ <span id="python-roles">
+ <span id="role-py-mod">
+ <span id="role-py-func">
+ <span id="role-py-data">
+ <span id="role-py-const">
+ <span id="role-py-class">
+ <span id="role-py-meth">
+ <span id="role-py-attr">
+ <span id="role-py-exc">
+ <span id="role-py-obj">
+
+See :doc:`/usage/domains/python`.
+
+
+MOVED: C Domain
---------------
-The math domain (name **math**) provides the following roles:
-
-.. rst:role:: math:numref
-
- Role for cross-referencing equations defined by :rst:dir:`math` directive
- via their label. Example::
-
- .. math:: e^{i\pi} + 1 = 0
- :label: euler
-
- Euler's identity, equation :math:numref:`euler`, was elected one of the
- most beautiful mathematical formulas.
-
- .. versionadded:: 1.8
+.. raw:: html
+
+ <span id="the-c-domain">
+ <span id="c-domain">
+ <span id="directive-c-member">
+ <span id="directive-c-var">
+ <span id="directive-c-function">
+ <span id="directive-option-c-function-single-line-parameter-list">
+ <span id="directive-c-macro">
+ <span id="directive-option-c-macro-single-line-parameter-list">
+ <span id="directive-c-struct">
+ <span id="directive-c-union">
+ <span id="directive-c-enum">
+ <span id="directive-c-enumerator">
+ <span id="directive-c-type">
+ <span id="cross-referencing-c-constructs">
+ <span id="c-roles">
+ <span id="role-c-member">
+ <span id="role-c-data">
+ <span id="role-c-var">
+ <span id="role-c-func">
+ <span id="role-c-macro">
+ <span id="role-c-struct">
+ <span id="role-c-union">
+ <span id="role-c-enum">
+ <span id="role-c-enumerator">
+ <span id="role-c-type">
+ <span id="anonymous-entities">
+ <span id="aliasing-declarations">
+ <span id="directive-c-alias">
+ <span id="directive-option-c-alias-maxdepth">
+ <span id="directive-option-c-alias-noroot">
+ <span id="inline-expressions-and-types">
+ <span id="role-c-expr">
+ <span id="role-c-texpr">
+ <span id="namespacing">
+ <span id="directive-c-namespace">
+ <span id="directive-c-namespace-push">
+ <span id="directive-c-namespace-pop">
+ <span id="configuration-variables">
+
+See :doc:`/usage/domains/c`.
+
+
+MOVED: C++ Domain
+-----------------
-More domains
-------------
+.. raw:: html
+
+ <span id="cpp-domain">
+ <span id="id2">
+ <span id="directives-for-declaring-entities">
+ <span id="directive-cpp-class">
+ <span id="directive-cpp-struct">
+ <span id="directive-cpp-function">
+ <span id="directive-option-cpp-function-single-line-parameter-list">
+ <span id="directive-cpp-member">
+ <span id="directive-cpp-var">
+ <span id="directive-cpp-type">
+ <span id="directive-cpp-enum">
+ <span id="directive-cpp-enum-struct">
+ <span id="directive-cpp-enum-class">
+ <span id="directive-cpp-enumerator">
+ <span id="directive-cpp-union">
+ <span id="directive-cpp-concept">
+ <span id="options">
+ <span id="id3">
+ <span id="id4">
+ <span id="directive-cpp-alias">
+ <span id="directive-option-cpp-alias-maxdepth">
+ <span id="directive-option-cpp-alias-noroot">
+ <span id="constrained-templates">
+ <span id="placeholders">
+ <span id="template-introductions">
+ <span id="id5">
+ <span id="role-cpp-expr">
+ <span id="role-cpp-texpr">
+ <span id="id6">
+ <span id="directive-cpp-namespace">
+ <span id="directive-cpp-namespace-push">
+ <span id="directive-cpp-namespace-pop">
+ <span id="id7">
+ <span id="cross-referencing">
+ <span id="cpp-roles">
+ <span id="role-cpp-any">
+ <span id="role-cpp-class">
+ <span id="role-cpp-struct">
+ <span id="role-cpp-func">
+ <span id="role-cpp-member">
+ <span id="role-cpp-var">
+ <span id="role-cpp-type">
+ <span id="role-cpp-concept">
+ <span id="role-cpp-enum">
+ <span id="role-cpp-enumerator">
+ <span id="declarations-without-template-parameters-and-template-arguments">
+ <span id="overloaded-member-functions">
+ <span id="templated-declarations">
+ <span id="full-template-specialisations">
+ <span id="partial-template-specialisations">
+ <span id="id8">
+
+See :doc:`/usage/domains/cpp`.
+
+
+MOVED: Standard Domain
+----------------------
+
+.. raw:: html
+
+ <span id="the-standard-domain">
+ <span id="domains-std">
+ <span id="directive-option">
+ <span id="directive-envvar">
+ <span id="directive-program">
+ <span id="directive-describe">
+ <span id="directive-object">
+
+See :doc:`/usage/domains/standard`.
+
+
+MOVED: JavaScript Domain
+------------------------
+
+.. raw:: html
+
+ <span id="the-javascript-domain">
+ <span id="directive-js-module">
+ <span id="directive-js-function">
+ <span id="directive-option-js-function-single-line-parameter-list">
+ <span id="directive-js-method">
+ <span id="directive-option-js-method-single-line-parameter-list">
+ <span id="directive-js-class">
+ <span id="directive-option-js-class-single-line-parameter-list">
+ <span id="directive-js-data">
+ <span id="directive-js-attribute">
+ <span id="js-roles">
+ <span id="role-js-mod">
+ <span id="role-js-func">
+ <span id="role-js-meth">
+ <span id="role-js-class">
+ <span id="role-js-data">
+ <span id="role-js-attr">
+
+See :doc:`/usage/domains/javascript`.
+
+
+MOVED: reStructuredText Domain
+------------------------------
+
+.. raw:: html
+
+ <span id="the-restructuredtext-domain">
+ <span id="directive-rst-directive">
+ <span id="directive-rst-directive-option">
+ <span id="directive-option-rst-directive-option-type">
+ <span id="directive-rst-role">
+ <span id="rst-roles">
+ <span id="role-rst-dir">
+ <span id="role-rst-role">
+
+See :doc:`/usage/domains/restructuredtext`.
+
+
+MOVED: Math Domain
+------------------
+
+.. raw:: html
+
+ <span id="the-math-domain">
+ <span id="math-domain">
+ <span id="role-math-numref">
+
+See :doc:`/usage/domains/mathematics`.
+
+MOVED: More domains
+-------------------
-The sphinx-contrib_ repository contains more domains available as extensions;
-currently Ada_, CoffeeScript_, Erlang_, HTTP_, Lasso_, MATLAB_, PHP_, and Ruby_
-domains. Also available are domains for `Chapel`_, `Common Lisp`_, dqn_, Go_,
-Jinja_, Operation_, and Scala_.
+.. raw:: html
-.. _sphinx-contrib: https://github.com/sphinx-contrib
+ <span id="more-domains">
-.. _Ada: https://pypi.org/project/sphinxcontrib-adadomain/
-.. _Chapel: https://pypi.org/project/sphinxcontrib-chapeldomain/
-.. _CoffeeScript: https://pypi.org/project/sphinxcontrib-coffee/
-.. _Common Lisp: https://pypi.org/project/sphinxcontrib-cldomain/
-.. _dqn: https://pypi.org/project/sphinxcontrib-dqndomain/
-.. _Erlang: https://pypi.org/project/sphinxcontrib-erlangdomain/
-.. _Go: https://pypi.org/project/sphinxcontrib-golangdomain/
-.. _HTTP: https://pypi.org/project/sphinxcontrib-httpdomain/
-.. _Jinja: https://pypi.org/project/sphinxcontrib-jinjadomain/
-.. _Lasso: https://pypi.org/project/sphinxcontrib-lassodomain/
-.. _MATLAB: https://pypi.org/project/sphinxcontrib-matlabdomain/
-.. _Operation: https://pypi.org/project/sphinxcontrib-operationdomain/
-.. _PHP: https://pypi.org/project/sphinxcontrib-phpdomain/
-.. _Ruby: https://github.com/sphinx-contrib/rubydomain
-.. _Scala: https://pypi.org/project/sphinxcontrib-scaladomain/
+See :doc:`/usage/domains/index`.
diff --git a/doc/usage/restructuredtext/field-lists.rst b/doc/usage/restructuredtext/field-lists.rst
index 5fc897d..d352633 100644
--- a/doc/usage/restructuredtext/field-lists.rst
+++ b/doc/usage/restructuredtext/field-lists.rst
@@ -48,9 +48,9 @@ At the moment, these metadata fields are recognized:
.. note::
- This metadata effects to the depth of local toctree. But it does not
- effect to the depth of *global* toctree. So this would not be change
- the sidebar of some themes which uses global one.
+ This metadata affects the depth of the local toctree. But it does not
+ affect the depth of the *global* toctree. So this does not change
+ the sidebar of themes that use the global toctree.
.. versionadded:: 0.4
@@ -73,6 +73,6 @@ At the moment, these metadata fields are recognized:
:nosearch:
- .. note:: object search is still available even if `nosearch` option is set.
+ .. note:: object search is still available even if ``nosearch`` option is set.
.. versionadded:: 3.0
diff --git a/doc/usage/restructuredtext/index.rst b/doc/usage/restructuredtext/index.rst
index 87b6ed6..ada40c5 100644
--- a/doc/usage/restructuredtext/index.rst
+++ b/doc/usage/restructuredtext/index.rst
@@ -8,9 +8,8 @@ reStructuredText (reST) is the default plaintext markup language used by both
Docutils and Sphinx. Docutils provides the basic reStructuredText syntax, while
Sphinx extends this to support additional functionality.
-The below guides go through the most important aspects of reST. For the
-authoritative reStructuredText reference, refer to the `docutils
-documentation`__.
+The below guides go through the most important aspects of reStructuredText.
+For the authoritative reference, refer to the `docutils documentation`__.
__ https://docutils.sourceforge.io/rst.html
@@ -21,4 +20,8 @@ __ https://docutils.sourceforge.io/rst.html
roles
directives
field-lists
+
+.. toctree::
+ :hidden:
+
domains
diff --git a/doc/usage/restructuredtext/roles.rst b/doc/usage/restructuredtext/roles.rst
index e468de9..ea5d99c 100644
--- a/doc/usage/restructuredtext/roles.rst
+++ b/doc/usage/restructuredtext/roles.rst
@@ -15,267 +15,28 @@ They are written as ``:rolename:`content```.
:rst:role:`any` role to find anything or the :rst:role:`py:obj` role to find
Python objects are very useful for this.
-See :doc:`/usage/restructuredtext/domains` for roles added by domains.
+See :doc:`/usage/domains/index` for roles added by domains.
-.. _xref-syntax:
-
Cross-referencing syntax
------------------------
-Cross-references are generated by many semantic interpreted text roles.
-Basically, you only need to write ``:role:`target```, and a link will be
-created to the item named *target* of the type indicated by *role*. The link's
-text will be the same as *target*.
-
-There are some additional facilities, however, that make cross-referencing
-roles more versatile:
-
-* You may supply an explicit title and reference target, like in reST direct
- hyperlinks: ``:role:`title <target>``` will refer to *target*, but the link
- text will be *title*.
-
-* If you prefix the content with ``!``, no reference/hyperlink will be created.
-
-* If you prefix the content with ``~``, the link text will only be the last
- component of the target. For example, ``:py:meth:`~Queue.Queue.get``` will
- refer to ``Queue.Queue.get`` but only display ``get`` as the link text. This
- does not work with all cross-reference roles, but is domain specific.
-
- In HTML output, the link's ``title`` attribute (that is e.g. shown as a
- tool-tip on mouse-hover) will always be the full target name.
-
-
-.. _any-role:
-
-Cross-referencing anything
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. rst:role:: any
-
- .. versionadded:: 1.3
-
- This convenience role tries to do its best to find a valid target for its
- reference text.
-
- * First, it tries standard cross-reference targets that would be referenced
- by :rst:role:`doc`, :rst:role:`ref` or :rst:role:`option`.
-
- Custom objects added to the standard domain by extensions (see
- :meth:`.Sphinx.add_object_type`) are also searched.
-
- * Then, it looks for objects (targets) in all loaded domains. It is up to
- the domains how specific a match must be. For example, in the Python
- domain a reference of ``:any:`Builder``` would match the
- ``sphinx.builders.Builder`` class.
-
- If none or multiple targets are found, a warning will be emitted. In the
- case of multiple targets, you can change "any" to a specific role.
-
- This role is a good candidate for setting :confval:`default_role`. If you
- do, you can write cross-references without a lot of markup overhead. For
- example, in this Python function documentation::
-
- .. function:: install()
-
- This function installs a `handler` for every signal known by the
- `signal` module. See the section `about-signals` for more information.
-
- there could be references to a glossary term (usually ``:term:`handler```), a
- Python module (usually ``:py:mod:`signal``` or ``:mod:`signal```) and a
- section (usually ``:ref:`about-signals```).
-
- The :rst:role:`any` role also works together with the
- :mod:`~sphinx.ext.intersphinx` extension: when no local cross-reference is
- found, all object types of intersphinx inventories are also searched.
-
-Cross-referencing objects
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-These roles are described with their respective domains:
-
-* :ref:`Python <python-roles>`
-* :ref:`C <c-roles>`
-* :ref:`C++ <cpp-roles>`
-* :ref:`JavaScript <js-roles>`
-* :ref:`ReST <rst-roles>`
-
-
-.. _ref-role:
-
-Cross-referencing arbitrary locations
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. rst:role:: ref
-
- To support cross-referencing to arbitrary locations in any document, the
- standard reST labels are used. For this to work label names must be unique
- throughout the entire documentation. There are two ways in which you can
- refer to labels:
-
- * If you place a label directly before a section title, you can reference to
- it with ``:ref:`label-name```. For example::
-
- .. _my-reference-label:
-
- Section to cross-reference
- --------------------------
-
- This is the text of the section.
-
- It refers to the section itself, see :ref:`my-reference-label`.
-
- The ``:ref:`` role would then generate a link to the section, with the
- link title being "Section to cross-reference". This works just as well
- when section and reference are in different source files.
-
- Automatic labels also work with figures. For example::
-
- .. _my-figure:
-
- .. figure:: whatever
-
- Figure caption
-
- In this case, a reference ``:ref:`my-figure``` would insert a reference
- to the figure with link text "Figure caption".
-
- The same works for tables that are given an explicit caption using the
- :dudir:`table` directive.
-
- * Labels that aren't placed before a section title can still be referenced,
- but you must give the link an explicit title, using this syntax:
- ``:ref:`Link title <label-name>```.
-
- .. note::
+See :doc:`/usage/referencing/`.
- Reference labels must start with an underscore. When referencing a label,
- the underscore must be omitted (see examples above).
+Cross-reference roles include:
- Using :rst:role:`ref` is advised over standard reStructuredText links to
- sections (like ```Section title`_``) because it works across files, when
- section headings are changed, will raise warnings if incorrect, and works
- for all builders that support cross-references.
+* :rst:role:`any`
+* :rst:role:`doc`
+* :rst:role:`download`
+* :rst:role:`envvar`
+* :rst:role:`keyword`
+* :rst:role:`numref`
+* :rst:role:`option` (and the deprecated :rst:role:`!cmdoption`)
+* :rst:role:`ref`
+* :rst:role:`term`
+* :rst:role:`token`
-Cross-referencing documents
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. versionadded:: 0.6
-
-There is also a way to directly link to documents:
-
-.. rst:role:: doc
-
- Link to the specified document; the document name can be specified in
- absolute or relative fashion. For example, if the reference
- ``:doc:`parrot``` occurs in the document ``sketches/index``, then the link
- refers to ``sketches/parrot``. If the reference is ``:doc:`/people``` or
- ``:doc:`../people```, the link refers to ``people``.
-
- If no explicit link text is given (like usual: ``:doc:`Monty Python members
- </people>```), the link caption will be the title of the given document.
-
-
-Referencing downloadable files
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. versionadded:: 0.6
-
-.. rst:role:: download
-
- This role lets you link to files within your source tree that are not reST
- documents that can be viewed, but files that can be downloaded.
-
- When you use this role, the referenced file is automatically marked for
- inclusion in the output when building (obviously, for HTML output only).
- All downloadable files are put into a ``_downloads/<unique hash>/``
- subdirectory of the output directory; duplicate filenames are handled.
-
- An example::
-
- See :download:`this example script <../example.py>`.
-
- The given filename is usually relative to the directory the current source
- file is contained in, but if it absolute (starting with ``/``), it is taken
- as relative to the top source directory.
-
- The ``example.py`` file will be copied to the output directory, and a
- suitable link generated to it.
-
- Not to show unavailable download links, you should wrap whole paragraphs that
- have this role::
-
- .. only:: builder_html
-
- See :download:`this example script <../example.py>`.
-
-Cross-referencing figures by figure number
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. versionadded:: 1.3
-
-.. versionchanged:: 1.5
- `numref` role can also refer sections.
- And `numref` allows `{name}` for the link text.
-
-.. rst:role:: numref
-
- Link to the specified figures, tables, code-blocks and sections; the standard
- reST labels are used. When you use this role, it will insert a reference to
- the figure with link text by its figure number like "Fig. 1.1".
-
- If an explicit link text is given (as usual: ``:numref:`Image of Sphinx (Fig.
- %s) <my-figure>```), the link caption will serve as title of the reference.
- As placeholders, `%s` and `{number}` get replaced by the figure
- number and `{name}` by the figure caption.
- If no explicit link text is given, the :confval:`numfig_format` setting is
- used as fall-back default.
-
- If :confval:`numfig` is ``False``, figures are not numbered,
- so this role inserts not a reference but the label or the link text.
-
-Cross-referencing other items of interest
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The following roles do possibly create a cross-reference, but do not refer to
-objects:
-
-.. rst:role:: envvar
-
- An environment variable. Index entries are generated. Also generates a link
- to the matching :rst:dir:`envvar` directive, if it exists.
-
-.. rst:role:: token
-
- The name of a grammar token (used to create links between
- :rst:dir:`productionlist` directives).
-
-.. rst:role:: keyword
-
- The name of a keyword in Python. This creates a link to a reference label
- with that name, if it exists.
-
-.. rst:role:: option
-
- A command-line option to an executable program. This generates a link to
- a :rst:dir:`option` directive, if it exists.
-
-
-The following role creates a cross-reference to a term in a
-:ref:`glossary <glossary-directive>`:
-
-.. rst:role:: term
-
- Reference to a term in a glossary. A glossary is created using the
- ``glossary`` directive containing a definition list with terms and
- definitions. It does not have to be in the same file as the ``term`` markup,
- for example the Python docs have one global glossary in the ``glossary.rst``
- file.
-
- If you use a term that's not explained in a glossary, you'll get a warning
- during build.
-
Inline code highlighting
------------------------
@@ -414,6 +175,10 @@ different style:
``:manpage:`ls(1)``` displays :manpage:`ls(1)`. Creates a hyperlink to an
external site rendering the manpage if :confval:`manpages_url` is defined.
+ .. versionchanged:: 7.3
+ Allow specifying a target with ``<>``, like hyperlinks.
+ For example, ``:manpage:`blah <ls(1)>``` displays :manpage:`blah <ls(1)>`.
+
.. rst:role:: menuselection
Menu selections should be marked using the ``menuselection`` role. This is
@@ -468,14 +233,17 @@ different style:
A piece of literal text, such as code. Within the contents, you can use
curly braces to indicate a "variable" part, as in :rst:role:`file`. For
- example, in ``:samp:`print 1+{variable}```, the part ``variable`` would be
- emphasized: :samp:`print 1+{variable}`
+ example, in ``:samp:`print(1+{variable})```, the part ``variable`` would be
+ emphasized: :samp:`print(1+{variable})`
If you don't need the "variable part" indication, use the standard
:rst:role:`code` role instead.
.. versionchanged:: 1.8
- Allowed to escape curly braces with backslash
+ Allowed to escape curly braces with double backslash. For example, in
+ ``:samp:`print(f"answer=\\{1+{variable}*2\\}")```, the part ``variable``
+ would be emphasized and the escaped curly braces would be displayed:
+ :samp:`print(f"answer=\\{1+{variable}*2\\}")`
There is also an :rst:role:`index` role to generate index entries.
@@ -500,7 +268,7 @@ The following roles generate external links:
For example: :rfc:`2324`
Note that there are no special roles for including hyperlinks as you can use
-the standard reST markup for that purpose.
+the standard reStructuredText markup for that purpose.
.. _default-substitutions:
@@ -508,7 +276,7 @@ the standard reST markup for that purpose.
Substitutions
-------------
-The documentation system provides three substitutions that are defined by
+The documentation system provides some substitutions that are defined by
default. They are set in the build configuration file.
.. describe:: |release|
@@ -532,5 +300,5 @@ default. They are set in the build configuration file.
.. describe:: |translation progress|
Replaced by the translation progress of the document.
- This substitution is intented for use by document translators
+ This substitution is intended for use by document translators
as a marker for the translation progress of the document.
diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst
index c33c7d4..135c2f5 100644
--- a/doc/usage/theming.rst
+++ b/doc/usage/theming.rst
@@ -22,7 +22,7 @@ Themes
This section provides information about using pre-existing HTML themes. If
you wish to create your own theme, refer to
- :doc:`/development/theming`.
+ :ref:`extension-html-theme`.
Sphinx supports changing the appearance of its HTML output via *themes*. A
theme is a collection of HTML templates, stylesheet(s) and other static files.
@@ -56,7 +56,7 @@ page's top and bottom), add the following :file:`conf.py`::
If the theme does not come with Sphinx, it can be in two static forms or as a
Python package. For the static forms, either a directory (containing
-:file:`theme.conf` and other needed files), or a zip file with the same
+:file:`theme.toml` and other needed files), or a zip file with the same
contents is supported. The directory or zipfile must be put where Sphinx can
find it; for this there is the config value :confval:`html_theme_path`. This
can be a list of directories, relative to the directory containing
@@ -81,7 +81,7 @@ zipfile-based theme::
html_theme = "dotted"
For more information on the design of themes, including information about
-writing your own themes, refer to :doc:`/development/theming`.
+writing your own themes, refer to :ref:`extension-html-theme`.
.. _builtin-themes:
@@ -325,10 +325,10 @@ These themes are:
are supported:
- **relbar1** (true or false, default ``True``): If this is true, the
- `relbar1` block is inserted in the epub output, otherwise it is omitted.
+ ``relbar1`` block is inserted in the epub output, otherwise it is omitted.
- **footer** (true or false, default ``True``): If this is true, the
- `footer` block is inserted in the epub output, otherwise it is omitted.
+ ``footer`` block is inserted in the epub output, otherwise it is omitted.
**bizstyle**
A simple bluish theme. The following options are supported