summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:20:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:20:58 +0000
commit5bb0bb4be543fd5eca41673696a62ed80d493591 (patch)
treead2c464f140e86c7f178a6276d7ea4a93e3e6c92 /doc
parentAdding upstream version 7.2.6. (diff)
downloadsphinx-upstream.tar.xz
sphinx-upstream.zip
Adding upstream version 7.3.7.upstream/7.3.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/_static/tutorial/lumache-autosummary.pngbin26500 -> 20729 bytes
-rw-r--r--doc/_static/tutorial/lumache-first-light.pngbin52126 -> 35872 bytes
-rw-r--r--doc/_static/tutorial/lumache-furo.pngbin51223 -> 40306 bytes
-rw-r--r--doc/_static/tutorial/lumache-py-function-full.pngbin71741 -> 56998 bytes
-rw-r--r--doc/_static/tutorial/lumache-py-function.pngbin41828 -> 33130 bytes
-rw-r--r--doc/_themes/sphinx13/layout.html11
-rw-r--r--doc/_themes/sphinx13/static/sphinx-logo.svg4
-rw-r--r--doc/_themes/sphinx13/static/sphinx13.css25
-rw-r--r--doc/_themes/sphinx13/static/sphinxheader.pngbin11719 -> 0 bytes
-rw-r--r--doc/_themes/sphinx13/theme.conf4
-rw-r--r--doc/_themes/sphinx13/theme.toml4
-rw-r--r--doc/authors.rst2
-rw-r--r--doc/changes.rst4
-rw-r--r--doc/conf.py156
-rw-r--r--doc/development/builders.rst18
-rw-r--r--doc/development/templating.rst5
-rw-r--r--doc/development/theming.rst125
-rw-r--r--doc/development/tutorials/examples/autodoc_intenum.py19
-rw-r--r--doc/development/tutorials/examples/helloworld.py8
-rw-r--r--doc/development/tutorials/examples/recipe.py46
-rw-r--r--doc/development/tutorials/examples/todo.py34
-rw-r--r--doc/development/tutorials/recipe.rst6
-rw-r--r--doc/examples.rst2
-rw-r--r--doc/extdev/appapi.rst3
-rw-r--r--doc/extdev/deprecated.rst14
-rw-r--r--doc/extdev/i18n.rst4
-rw-r--r--doc/extdev/nodes.rst2
-rw-r--r--doc/extdev/utils.rst6
-rw-r--r--doc/faq.rst2
-rw-r--r--doc/glossary.rst2
-rw-r--r--doc/index.rst2
-rw-r--r--doc/internals/code-of-conduct.rst2
-rw-r--r--doc/internals/contributing.rst12
-rw-r--r--doc/internals/organization.rst2
-rw-r--r--doc/internals/release-process.rst4
-rw-r--r--doc/latex.rst4
-rw-r--r--doc/man/sphinx-build.rst191
-rw-r--r--doc/man/sphinx-quickstart.rst3
-rw-r--r--doc/support.rst2
-rw-r--r--doc/tutorial/automatic-doc-generation.rst2
-rw-r--r--doc/tutorial/deploying.rst15
-rw-r--r--doc/tutorial/describing-code.rst12
-rw-r--r--doc/tutorial/getting-started.rst2
-rw-r--r--doc/usage/advanced/intl.rst2
-rw-r--r--doc/usage/advanced/websupport/quickstart.rst4
-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.rst71
-rw-r--r--doc/usage/configuration.rst124
-rw-r--r--doc/usage/domains/c.rst367
-rw-r--r--doc/usage/domains/cpp.rst760
-rw-r--r--doc/usage/domains/index.rst208
-rw-r--r--doc/usage/domains/javascript.rst132
-rw-r--r--doc/usage/domains/mathematics.rst22
-rw-r--r--doc/usage/domains/python.rst688
-rw-r--r--doc/usage/domains/restructuredtext.rst99
-rw-r--r--doc/usage/domains/standard.rst95
-rw-r--r--doc/usage/extensions/autodoc.rst2
-rw-r--r--doc/usage/extensions/coverage.rst6
-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.rst2
-rw-r--r--doc/usage/extensions/intersphinx.rst1
-rw-r--r--doc/usage/extensions/math.rst4
-rw-r--r--doc/usage/extensions/napoleon.rst8
-rw-r--r--doc/usage/index.rst2
-rw-r--r--doc/usage/installation.rst6
-rw-r--r--doc/usage/quickstart.rst10
-rw-r--r--doc/usage/referencing.rst258
-rw-r--r--doc/usage/restructuredtext/basics.rst2
-rw-r--r--doc/usage/restructuredtext/directives.rst28
-rw-r--r--doc/usage/restructuredtext/domains.rst2563
-rw-r--r--doc/usage/restructuredtext/field-lists.rst2
-rw-r--r--doc/usage/restructuredtext/index.rst4
-rw-r--r--doc/usage/restructuredtext/roles.rst282
-rw-r--r--doc/usage/theming.rst6
76 files changed, 3637 insertions, 2891 deletions
diff --git a/doc/_static/tutorial/lumache-autosummary.png b/doc/_static/tutorial/lumache-autosummary.png
index ed54ea3..f3d98a5 100644
--- a/doc/_static/tutorial/lumache-autosummary.png
+++ b/doc/_static/tutorial/lumache-autosummary.png
Binary files differ
diff --git a/doc/_static/tutorial/lumache-first-light.png b/doc/_static/tutorial/lumache-first-light.png
index fbf4aec..9a604cd 100644
--- a/doc/_static/tutorial/lumache-first-light.png
+++ b/doc/_static/tutorial/lumache-first-light.png
Binary files differ
diff --git a/doc/_static/tutorial/lumache-furo.png b/doc/_static/tutorial/lumache-furo.png
index c7aaee7..e3a1367 100644
--- a/doc/_static/tutorial/lumache-furo.png
+++ b/doc/_static/tutorial/lumache-furo.png
Binary files differ
diff --git a/doc/_static/tutorial/lumache-py-function-full.png b/doc/_static/tutorial/lumache-py-function-full.png
index d13b637..9991b52 100644
--- a/doc/_static/tutorial/lumache-py-function-full.png
+++ b/doc/_static/tutorial/lumache-py-function-full.png
Binary files differ
diff --git a/doc/_static/tutorial/lumache-py-function.png b/doc/_static/tutorial/lumache-py-function.png
index 06129d5..bf18d85 100644
--- a/doc/_static/tutorial/lumache-py-function.png
+++ b/doc/_static/tutorial/lumache-py-function.png
Binary files differ
diff --git a/doc/_themes/sphinx13/layout.html b/doc/_themes/sphinx13/layout.html
index 86a7943..aae163a 100644
--- a/doc/_themes/sphinx13/layout.html
+++ b/doc/_themes/sphinx13/layout.html
@@ -3,16 +3,17 @@
{% block extrahead %}
{{ super() }}
-{%- if not embedded and pagename == 'index' %}
+{%- if not embedded and pagename == root_doc %}
<style>.related { display: none; }</style>
{%- endif %}
{% endblock %}
{% block header %}
<div class="pageheader">
-<a href="{{ pathto('index') }}">
- <img src="{{ pathto('_static/sphinxheader.png', 1) }}" alt="SPHINX" />
-</a>
+ <a href="{{ pathto(root_doc)|e }}">
+ <img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" />
+ </a>
+ <h1>Sphinx</h1>
</div>
{% endblock %}
@@ -20,7 +21,7 @@
<div class="related" role="navigation" aria-label="related navigation">
<h3>{{ _('Navigation') }}</h3>
<ul>
- <li><a href="{{ pathto('index') }}">Documentation</a> &raquo;</li>
+ <li><a href="{{ pathto(root_doc)|e }}">Documentation</a> &raquo;</li>
{%- for parent in parents %}
<li class="nav-item nav-item-{{ loop.index }}"><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
{%- endfor %}
diff --git a/doc/_themes/sphinx13/static/sphinx-logo.svg b/doc/_themes/sphinx13/static/sphinx-logo.svg
new file mode 100644
index 0000000..b2b83c7
--- /dev/null
+++ b/doc/_themes/sphinx13/static/sphinx-logo.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 7">
+<path d="M8.12 3.27c.45-.32 1.06-.46 1.78-.73l-.31-.7c-1.28.23-2.43-.53-3.68-.7C4 .75 2.24 1.9.36 2.04v.76c1.87.41 3.64 1.26 5.6 1.02-1.21 1.21-2.84 2.64-4.69 2.07C.63 5.77.35 4.87.96 4.6c.27 1.04 1.57.3 1-.52C1.57 3.6.54 3.82.24 4.3c-.87 1.65.84 2.56 2.31 2.32 1.86-.25 3.29-1.71 4.53-3.02-.02.61.18 1.96-.41 2.5l.01.9c.43-.34.8-1.07.92-1.56.16-.63.04-1.02.1-1.53.05-.23.1-.41.42-.64zM1.9 2.39c.77-.23 1.58-.58 2.39-.66-.42 1.38 1.81 1.54 1.56 0 .64.16 1 .3 1.94.7-2.06 1.02-4.05.56-5.89-.04z"/>
+<path d="M.36 1.81v-.8c.23 0 .84-.18 1.44-.35C2.8.36 4.05 0 4.95 0c1 0 2.05.34 2.82.58l.91.25c.62.07.98-.08.98-.08l.34.73c-.06.02-.56.24-1.41.15-.27-.03-.62-.14-1.06-.29C6.77 1.1 5.82.8 4.95.8c-.79 0-1.97.35-2.92.63-.74.21-1.32.38-1.67.38z"/>
+</svg>
diff --git a/doc/_themes/sphinx13/static/sphinx13.css b/doc/_themes/sphinx13/static/sphinx13.css
index 674d211..3234a37 100644
--- a/doc/_themes/sphinx13/static/sphinx13.css
+++ b/doc/_themes/sphinx13/static/sphinx13.css
@@ -2,7 +2,7 @@
/* Set master colours */
:root {
- --fonts-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
+ --fonts-sans-serif: system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--colour-sphinx-blue: #0A507A;
--colour-text: #333;
--colour-links-light: #057;
@@ -15,8 +15,29 @@ body {
}
.pageheader {
+ display: flex;
+ column-gap: 1em;
+ align-items: center;
+ width: 100%;
background-color: var(--colour-sphinx-blue);
- padding: 10px 15px;
+ padding: 10px 20px;
+}
+
+.pageheader a {
+ width: 5%;
+}
+
+.pageheader img {
+ filter: invert(1) drop-shadow(1px 1px 2px black);
+}
+
+.pageheader h1{
+ color: white;
+ margin: 0;
+ font-weight: 600;
+ font-size: 3.5rem;
+ line-height: 1;
+ font-variant: small-caps;
}
div.document {
diff --git a/doc/_themes/sphinx13/static/sphinxheader.png b/doc/_themes/sphinx13/static/sphinxheader.png
deleted file mode 100644
index 845da4a..0000000
--- a/doc/_themes/sphinx13/static/sphinxheader.png
+++ /dev/null
Binary files differ
diff --git a/doc/_themes/sphinx13/theme.conf b/doc/_themes/sphinx13/theme.conf
deleted file mode 100644
index 78bb78f..0000000
--- a/doc/_themes/sphinx13/theme.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[theme]
-inherit = basic
-pygments_style = default
-sidebars =
diff --git a/doc/_themes/sphinx13/theme.toml b/doc/_themes/sphinx13/theme.toml
new file mode 100644
index 0000000..ba4fb2b
--- /dev/null
+++ b/doc/_themes/sphinx13/theme.toml
@@ -0,0 +1,4 @@
+[theme]
+inherit = "basic"
+pygments_style = { default = "default" }
+sidebars = []
diff --git a/doc/authors.rst b/doc/authors.rst
index 411835b..015420d 100644
--- a/doc/authors.rst
+++ b/doc/authors.rst
@@ -6,4 +6,4 @@
Sphinx authors
==============
-.. include:: ../AUTHORS
+.. include:: ../AUTHORS.rst
diff --git a/doc/changes.rst b/doc/changes.rst
index 96853fe..ac9b346 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -1,7 +1,5 @@
:tocdepth: 1
-.. default-role:: any
-
.. _changes:
=========
@@ -19,4 +17,4 @@ Changelog
\makeatother
-.. include:: ../CHANGES
+.. include:: ../CHANGES.rst
diff --git a/doc/conf.py b/doc/conf.py
index d4915aa..49fcba4 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -8,11 +8,17 @@ import sphinx
os.environ['SPHINX_AUTODOC_RELOAD_MODULES'] = '1'
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
- 'sphinx.ext.autosummary', 'sphinx.ext.extlinks',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.viewcode', 'sphinx.ext.inheritance_diagram',
- 'sphinx.ext.coverage']
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.todo',
+ 'sphinx.ext.autosummary',
+ 'sphinx.ext.extlinks',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.viewcode',
+ 'sphinx.ext.inheritance_diagram',
+ 'sphinx.ext.coverage',
+]
coverage_statistics_to_report = coverage_statistics_to_stdout = True
templates_path = ['_templates']
exclude_patterns = ['_build']
@@ -22,6 +28,8 @@ copyright = f'2007-{time.strftime("%Y")}, the Sphinx developers'
version = sphinx.__display_version__
release = version
show_authors = True
+nitpicky = True
+show_warning_types = True
html_theme = 'sphinx13'
html_theme_path = ['_themes']
@@ -47,73 +55,107 @@ epub_uid = 'web-site'
epub_scheme = 'url'
epub_identifier = epub_publisher
epub_pre_files = [('index.xhtml', 'Welcome')]
-epub_post_files = [('usage/installation.xhtml', 'Installing Sphinx'),
- ('develop.xhtml', 'Sphinx development')]
-epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js',
- '_static/searchtools.js',
- '_static/sphinx_highlight.js',
- '_static/basic.css',
- '_static/language_data.js',
- 'search.html', '_static/websupport.js']
+epub_post_files = [
+ ('usage/installation.xhtml', 'Installing Sphinx'),
+ ('develop.xhtml', 'Sphinx development'),
+]
+epub_exclude_files = [
+ '_static/opensearch.xml',
+ '_static/doctools.js',
+ '_static/searchtools.js',
+ '_static/sphinx_highlight.js',
+ '_static/basic.css',
+ '_static/language_data.js',
+ 'search.html',
+ '_static/websupport.js',
+]
epub_fix_images = False
epub_max_image_width = 0
epub_show_urls = 'inline'
epub_use_index = False
epub_description = 'Sphinx documentation generator system manual'
-latex_documents = [('index', 'sphinx.tex', 'Sphinx Documentation',
- 'the Sphinx developers', 'manual', 1)]
+latex_documents = [
+ ('index', 'sphinx.tex', 'Sphinx Documentation', 'the Sphinx developers', 'manual', 1)
+]
latex_logo = '_static/sphinx.png'
latex_elements = {
'fontenc': r'\usepackage[LGR,X2,T1]{fontenc}',
- 'passoptionstopackages': r'''
+ 'passoptionstopackages': r"""
\PassOptionsToPackage{svgnames}{xcolor}
-''',
- 'preamble': r'''
+""",
+ 'preamble': r"""
\DeclareUnicodeCharacter{229E}{\ensuremath{\boxplus}}
\setcounter{tocdepth}{3}% depth of what main TOC shows (3=subsubsection)
\setcounter{secnumdepth}{1}% depth of section numbering
\setlength{\tymin}{2cm}% avoid too cramped table columns
-''',
+""",
# fix missing index entry due to RTD doing only once pdflatex after makeindex
- 'printindex': r'''
+ 'printindex': r"""
\IfFileExists{\jobname.ind}
{\footnotesize\raggedright\printindex}
{\begin{sphinxtheindex}\end{sphinxtheindex}}
-''',
+""",
}
latex_show_urls = 'footnote'
latex_use_xindy = True
linkcheck_timeout = 5
+linkcheck_ignore = [
+ r'^contents\.html$', # extra generated page
+ r'^\.\./contents\.html$',
+ re.escape('https://gitlab.com/projects/new'), # requires sign-in
+ re.escape('https://web.libera.chat/?channel=#sphinx-doc'),
+]
+linkcheck_anchors_ignore_for_url = [
+ # anchors in Markdown files cannot be accessed directly
+ 'https://github.com/Khan/style-guides/blob/master/style/python.md',
+]
autodoc_member_order = 'groupwise'
autosummary_generate = False
todo_include_todos = True
-extlinks = {'duref': ('https://docutils.sourceforge.io/docs/ref/rst/'
- 'restructuredtext.html#%s', '%s'),
- 'durole': ('https://docutils.sourceforge.io/docs/ref/rst/'
- 'roles.html#%s', '%s'),
- 'dudir': ('https://docutils.sourceforge.io/docs/ref/rst/'
- 'directives.html#%s', '%s')}
+extlinks = {
+ 'dupage': ('https://docutils.sourceforge.io/docs/ref/rst/' '%s.html', '%s'),
+ 'duref': (
+ 'https://docutils.sourceforge.io/docs/ref/rst/' 'restructuredtext.html#%s',
+ '%s',
+ ),
+ 'durole': ('https://docutils.sourceforge.io/docs/ref/rst/' 'roles.html#%s', '%s'),
+ 'dudir': ('https://docutils.sourceforge.io/docs/ref/rst/' 'directives.html#%s', '%s'),
+}
man_pages = [
- ('index', 'sphinx-all', 'Sphinx documentation generator system manual',
- 'the Sphinx developers', 1),
- ('man/sphinx-build', 'sphinx-build', 'Sphinx documentation generator tool',
- '', 1),
- ('man/sphinx-quickstart', 'sphinx-quickstart', 'Sphinx documentation '
- 'template generator', '', 1),
- ('man/sphinx-apidoc', 'sphinx-apidoc', 'Sphinx API doc generator tool',
- '', 1),
- ('man/sphinx-autogen', 'sphinx-autogen', 'Generate autodoc stub pages',
- '', 1),
+ (
+ 'index',
+ 'sphinx-all',
+ 'Sphinx documentation generator system manual',
+ 'the Sphinx developers',
+ 1,
+ ),
+ ('man/sphinx-build', 'sphinx-build', 'Sphinx documentation generator tool', '', 1),
+ (
+ 'man/sphinx-quickstart',
+ 'sphinx-quickstart',
+ 'Sphinx documentation ' 'template generator',
+ '',
+ 1,
+ ),
+ ('man/sphinx-apidoc', 'sphinx-apidoc', 'Sphinx API doc generator tool', '', 1),
+ ('man/sphinx-autogen', 'sphinx-autogen', 'Generate autodoc stub pages', '', 1),
]
texinfo_documents = [
- ('index', 'sphinx', 'Sphinx Documentation', 'the Sphinx developers',
- 'Sphinx', 'The Sphinx documentation builder.', 'Documentation tools',
- 1),
+ (
+ 'index',
+ 'sphinx',
+ 'Sphinx Documentation',
+ 'the Sphinx developers',
+ 'Sphinx',
+ 'The Sphinx documentation builder.',
+ 'Documentation tools',
+ 1,
+ ),
]
intersphinx_mapping = {
@@ -127,7 +169,10 @@ locale_dirs = ['locale/']
gettext_compact = False
nitpick_ignore = {
- ('cpp:class', 'template<typename TOuter> template<typename TInner> Wrapper::Outer<TOuter>::Inner'), # NoQA: E501
+ (
+ 'cpp:class',
+ 'template<typename TOuter> template<typename TInner> Wrapper::Outer<TOuter>::Inner',
+ ), # NoQA: E501
('cpp:identifier', 'MyContainer'),
('js:func', 'SomeError'),
('js:func', 'number'),
@@ -188,7 +233,7 @@ nitpick_ignore = {
# -- Extension interface -------------------------------------------------------
-from sphinx import addnodes # noqa: E402
+from sphinx import addnodes # NoQA: E402
event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)')
@@ -209,16 +254,15 @@ def parse_event(env, sig, signode):
def linkify_issues_in_changelog(app, docname, source):
- """ Linkify issue references like #123 in changelog to GitHub. """
-
+ """Linkify issue references like #123 in changelog to GitHub."""
if docname == 'changes':
- changelog_path = os.path.join(os.path.dirname(__file__), "../CHANGES")
+ changelog_path = os.path.join(os.path.dirname(__file__), '../CHANGES.rst')
# this path trickery is needed because this script can
# be invoked with different working directories:
# * running make in docs/
# * running tox -e docs in the repo root dir
- with open(changelog_path, encoding="utf-8") as f:
+ with open(changelog_path, encoding='utf-8') as f:
changelog = f.read()
def linkify(match):
@@ -227,18 +271,22 @@ def linkify_issues_in_changelog(app, docname, source):
linkified_changelog = re.sub(r'(?:PR)?#([0-9]+)\b', linkify, changelog)
- source[0] = source[0].replace('.. include:: ../CHANGES', linkified_changelog)
+ source[0] = source[0].replace('.. include:: ../CHANGES.rst', linkified_changelog)
def setup(app):
from sphinx.ext.autodoc import cut_lines
from sphinx.util.docfields import GroupedField
+
app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
app.connect('source-read', linkify_issues_in_changelog)
- app.add_object_type('confval', 'confval',
- objname='configuration value',
- indextemplate='pair: %s; configuration value')
- fdesc = GroupedField('parameter', label='Parameters',
- names=['param'], can_collapse=True)
- app.add_object_type('event', 'event', 'pair: %s; event', parse_event,
- doc_field_types=[fdesc])
+ app.add_object_type(
+ 'confval',
+ 'confval',
+ objname='configuration value',
+ indextemplate='pair: %s; configuration value',
+ )
+ fdesc = GroupedField('parameter', label='Parameters', names=['param'], can_collapse=True)
+ app.add_object_type(
+ 'event', 'event', 'pair: %s; event', parse_event, doc_field_types=[fdesc]
+ )
diff --git a/doc/development/builders.rst b/doc/development/builders.rst
index bb67770..7792fbd 100644
--- a/doc/development/builders.rst
+++ b/doc/development/builders.rst
@@ -10,25 +10,19 @@ Discover builders by entry point
that they do not have to be listed in the :confval:`extensions` configuration
value.
-Builder extensions should define an entry point in the ``sphinx.builders``
+Builder extensions should define an entry point in the ``"sphinx.builders"``
group. The name of the entry point needs to match your builder's
:attr:`~.Builder.name` attribute, which is the name passed to the
:option:`sphinx-build -b` option. The entry point value should equal the
dotted name of the extension module. Here is an example of how an entry point
-for 'mybuilder' can be defined in the extension's ``setup.py``
+for 'mybuilder' can be defined in the extension's ``pyproject.toml``
-.. code-block:: python
+.. code-block:: toml
- setup(
- # ...
- entry_points={
- 'sphinx.builders': [
- 'mybuilder = my.extension.module',
- ],
- }
- )
+ [project.entry-points."sphinx.builders"]
+ mybuilder = "my.extension.module"
Note that it is still necessary to register the builder using
:meth:`~.Sphinx.add_builder` in the extension's :func:`setup` function.
-.. _entry points: https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins
+.. _entry points: https://setuptools.pypa.io/en/latest/userguide/entry_point.html
diff --git a/doc/development/templating.rst b/doc/development/templating.rst
index 73ae6e5..016b8b8 100644
--- a/doc/development/templating.rst
+++ b/doc/development/templating.rst
@@ -30,6 +30,7 @@ No. You have several other options:
produces pickle files with the page contents, and postprocess them using a
custom tool, or use them in your Web application.
+.. _templating-primer:
Jinja/Sphinx Templating Primer
------------------------------
@@ -108,7 +109,7 @@ The following blocks exist in the ``layout.html`` template:
parent documents on the left, and the links to index, modules etc. on the
right). ``relbar1`` appears before the document, ``relbar2`` after the
document. By default, both blocks are filled; to show the relbar only
- before the document, you would override `relbar2` like this::
+ before the document, you would override ``relbar2`` like this::
{% block relbar2 %}{% endblock %}
@@ -422,7 +423,7 @@ are in HTML form), these variables are also available:
.. data:: next
The next document for the navigation. This variable is either false or has
- two attributes `link` and `title`. The title contains HTML markup. For
+ two attributes ``link`` and ``title``. The title contains HTML markup. For
example, to generate a link to the next page, you can use this snippet::
{% if next %}
diff --git a/doc/development/theming.rst b/doc/development/theming.rst
index 538dcaf..13a5802 100644
--- a/doc/development/theming.rst
+++ b/doc/development/theming.rst
@@ -30,11 +30,85 @@ Creating themes
Themes take the form of either a directory or a zipfile (whose name is the
theme name), containing the following:
-* A :file:`theme.conf` file.
+* Either a :file:`theme.toml` file (preferred) or a :file:`theme.conf` file.
* HTML templates, if needed.
* A ``static/`` directory containing any static files that will be copied to the
output static directory on build. These can be images, styles, script files.
+Theme configuration (``theme.toml``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The :file:`theme.toml` file is a TOML_ document,
+containing two tables: ``[theme]`` and ``[options]``.
+
+The ``[theme]`` table defines the theme's settings:
+
+* **inherit** (string): The name of the base theme from which to inherit
+ settings, options, templates, and static files.
+ All static files from theme 'ancestors' will be used.
+ The theme will use all options defined in inherited themes.
+ Finally, inherited themes will be used to locate missing templates
+ (for example, if ``"basic"`` is used as the base theme, most templates will
+ already be defined).
+
+ If set to ``"none"``, the theme will not inherit from any other theme.
+ Inheritance is recursive, forming a chain of inherited themes
+ (e.g. ``default`` -> ``classic`` -> ``basic`` -> ``none``).
+
+* **stylesheets** (list of strings): A list of CSS filenames which will be
+ included in generated HTML header.
+ Setting the :confval:`html_style` config value will override this setting.
+
+ Other mechanisms for including multiple stylesheets include ``@import`` in CSS
+ or using a custom HTML template with appropriate ``<link rel="stylesheet">`` tags.
+
+* **sidebars** (list of strings): A list of sidebar templates.
+ This can be overridden by the user via the :confval:`html_sidebars` config value.
+
+* **pygments_style** (table): A TOML table defining the names of Pygments styles
+ to use for highlighting syntax.
+ The table has two recognised keys: ``default`` and ``dark``.
+ The style defined in the ``dark`` key will be used when
+ the CSS media query ``(prefers-color-scheme: dark)`` evaluates to true.
+
+ ``[theme.pygments_style.default]`` can be overridden by the user via the
+ :confval:`pygments_style` config value.
+
+The ``[options]`` table defines the options for the theme.
+It is structured such that each key-value pair corresponds to a variable name
+and the corresponding default value.
+These options can be overridden by the user in :confval:`html_theme_options`
+and are accessible from all templates as ``theme_<name>``.
+
+.. versionadded:: 7.3
+ ``theme.toml`` support.
+
+.. _TOML: https://toml.io/en/
+
+Exemplar :file:`theme.toml` file:
+
+.. code-block:: toml
+
+ [theme]
+ inherit = "basic"
+ stylesheets = [
+ "main-CSS-stylesheet.css",
+ ]
+ sidebars = [
+ "localtoc.html",
+ "relations.html",
+ "sourcelink.html",
+ "searchbox.html",
+ ]
+ # Style names from https://pygments.org/styles/
+ pygments_style = { default = "style_name", dark = "dark_style" }
+
+ [options]
+ variable = "default value"
+
+Theme configuration (``theme.conf``)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
The :file:`theme.conf` file is in INI format [1]_ (readable by the standard
Python :mod:`configparser` module) and has the following structure:
@@ -86,6 +160,24 @@ Python :mod:`configparser` module) and has the following structure:
The stylesheet setting accepts multiple CSS filenames
+Convert ``theme.conf`` to ``theme.toml``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+INI-style theme configuration files (``theme.conf``) can be converted to TOML
+via a helper programme distributed with Sphinx.
+This is intended for one-time use, and may be removed without notice in a future
+version of Sphinx.
+
+.. code-block:: console
+
+ $ python -m sphinx.theming conf_to_toml [THEME DIRECTORY PATH]
+
+The required argument is a path to a directory containing a ``theme.conf`` file.
+The programme will write a ``theme.toml`` file in the same directory,
+and will not modify the original ``theme.conf`` file.
+
+.. versionadded:: 7.3
+
.. _distribute-your-theme:
Distribute your theme as a Python package
@@ -95,21 +187,20 @@ As a way to distribute your theme, you can use a Python package. This makes it
easier for users to set up your theme.
To distribute your theme as a Python package, please define an entry point
-called ``sphinx.html_themes`` in your ``setup.py`` file, and write a ``setup()``
-function to register your themes using ``add_html_theme()`` API in it::
-
- # 'setup.py'
- setup(
- ...
- entry_points = {
- 'sphinx.html_themes': [
- 'name_of_theme = your_package',
- ]
- },
- ...
- )
-
- # 'your_package.py'
+called ``sphinx.html_themes`` in your ``pyproject.toml`` file,
+and write a ``setup()`` function to register your theme
+using the :meth:`~sphinx.application.Sphinx.add_html_theme` API:
+
+.. code-block:: toml
+
+ # pyproject.toml
+
+ [project.entry-points."sphinx.html_themes"]
+ name_of_theme = "your_theme_package"
+
+.. code-block:: python
+
+ # your_theme_package.py
from os import path
def setup(app):
@@ -142,7 +233,7 @@ searches for templates:
When extending a template in the base theme with the same name, use the theme
name as an explicit directory: ``{% extends "basic/layout.html" %}``. From a
user ``templates_path`` template, you can still use the "exclamation mark"
-syntax as described in the templating document.
+syntax as :ref:`described in the templating document <templating-primer>`.
.. _theming-static-templates:
diff --git a/doc/development/tutorials/examples/autodoc_intenum.py b/doc/development/tutorials/examples/autodoc_intenum.py
index 75fa204..c52bb4c 100644
--- a/doc/development/tutorials/examples/autodoc_intenum.py
+++ b/doc/development/tutorials/examples/autodoc_intenum.py
@@ -19,9 +19,9 @@ class IntEnumDocumenter(ClassDocumenter):
option_spec['hex'] = bool_option
@classmethod
- def can_document_member(cls,
- member: Any, membername: str,
- isattr: bool, parent: Any) -> bool:
+ def can_document_member(
+ cls, member: Any, membername: str, isattr: bool, parent: Any
+ ) -> bool:
try:
return issubclass(member, IntEnum)
except TypeError:
@@ -31,11 +31,11 @@ class IntEnumDocumenter(ClassDocumenter):
super().add_directive_header(sig)
self.add_line(' :final:', self.get_sourcename())
- def add_content(self,
- more_content: StringList | None,
- no_docstring: bool = False,
- ) -> None:
-
+ def add_content(
+ self,
+ more_content: StringList | None,
+ no_docstring: bool = False,
+ ) -> None:
super().add_content(more_content, no_docstring)
source_name = self.get_sourcename()
@@ -48,8 +48,7 @@ class IntEnumDocumenter(ClassDocumenter):
if use_hex:
the_member_value = hex(the_member_value)
- self.add_line(
- f"**{the_member_name}**: {the_member_value}", source_name)
+ self.add_line(f'**{the_member_name}**: {the_member_value}', source_name)
self.add_line('', source_name)
diff --git a/doc/development/tutorials/examples/helloworld.py b/doc/development/tutorials/examples/helloworld.py
index d6d81fd..da29562 100644
--- a/doc/development/tutorials/examples/helloworld.py
+++ b/doc/development/tutorials/examples/helloworld.py
@@ -1,16 +1,18 @@
from docutils import nodes
from docutils.parsers.rst import Directive
+from sphinx.application import Sphinx
+from sphinx.util.typing import ExtensionMetadata
-class HelloWorld(Directive):
+class HelloWorld(Directive):
def run(self):
paragraph_node = nodes.paragraph(text='Hello World!')
return [paragraph_node]
-def setup(app):
- app.add_directive("helloworld", HelloWorld)
+def setup(app: Sphinx) -> ExtensionMetadata:
+ app.add_directive('helloworld', HelloWorld)
return {
'version': '0.1',
diff --git a/doc/development/tutorials/examples/recipe.py b/doc/development/tutorials/examples/recipe.py
index c7ebf2a..28d25f2 100644
--- a/doc/development/tutorials/examples/recipe.py
+++ b/doc/development/tutorials/examples/recipe.py
@@ -3,10 +3,12 @@ from collections import defaultdict
from docutils.parsers.rst import directives
from sphinx import addnodes
+from sphinx.application import Sphinx
from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, Index
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode
+from sphinx.util.typing import ExtensionMetadata
class RecipeDirective(ObjectDescription):
@@ -25,8 +27,7 @@ class RecipeDirective(ObjectDescription):
def add_target_and_index(self, name_cls, sig, signode):
signode['ids'].append('recipe' + '-' + sig)
if 'contains' in self.options:
- ingredients = [
- x.strip() for x in self.options.get('contains').split(',')]
+ ingredients = [x.strip() for x in self.options.get('contains').split(',')]
recipes = self.env.get_domain('recipe')
recipes.add_recipe(sig, ingredients)
@@ -42,9 +43,10 @@ class IngredientIndex(Index):
def generate(self, docnames=None):
content = defaultdict(list)
- recipes = {name: (dispname, typ, docname, anchor)
- for name, dispname, typ, docname, anchor, _
- in self.domain.get_objects()}
+ recipes = {
+ name: (dispname, typ, docname, anchor)
+ for name, dispname, typ, docname, anchor, _ in self.domain.get_objects()
+ }
recipe_ingredients = self.domain.data['recipe_ingredients']
ingredient_recipes = defaultdict(list)
@@ -60,8 +62,7 @@ class IngredientIndex(Index):
for ingredient, recipe_names in ingredient_recipes.items():
for recipe_name in recipe_names:
dispname, typ, docname, anchor = recipes[recipe_name]
- content[ingredient].append(
- (dispname, 0, docname, anchor, docname, '', typ))
+ content[ingredient].append((dispname, 0, docname, anchor, docname, '', typ))
# convert the dict to the sorted list of tuples expected
content = sorted(content.items())
@@ -88,8 +89,15 @@ class RecipeIndex(Index):
#
# name, subtype, docname, anchor, extra, qualifier, description
for _name, dispname, typ, docname, anchor, _priority in recipes:
- content[dispname[0].lower()].append(
- (dispname, 0, docname, anchor, docname, '', typ))
+ content[dispname[0].lower()].append((
+ dispname,
+ 0,
+ docname,
+ anchor,
+ docname,
+ '',
+ typ,
+ ))
# convert the dict to the sorted list of tuples expected
content = sorted(content.items())
@@ -98,7 +106,6 @@ class RecipeIndex(Index):
class RecipeDomain(Domain):
-
name = 'recipe'
label = 'Recipe Sample'
roles = {
@@ -122,18 +129,18 @@ class RecipeDomain(Domain):
def get_objects(self):
yield from self.data['recipes']
- def resolve_xref(self, env, fromdocname, builder, typ, target, node,
- contnode):
- match = [(docname, anchor)
- for name, sig, typ, docname, anchor, prio
- in self.get_objects() if sig == target]
+ def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
+ match = [
+ (docname, anchor)
+ for name, sig, typ, docname, anchor, prio in self.get_objects()
+ if sig == target
+ ]
if len(match) > 0:
todocname = match[0][0]
targ = match[0][1]
- return make_refnode(builder, fromdocname, todocname, targ,
- contnode, targ)
+ return make_refnode(builder, fromdocname, todocname, targ, contnode, targ)
else:
print('Awww, found nothing')
return None
@@ -145,11 +152,10 @@ class RecipeDomain(Domain):
self.data['recipe_ingredients'][name] = ingredients
# name, dispname, type, docname, anchor, priority
- self.data['recipes'].append(
- (name, signature, 'Recipe', self.env.docname, anchor, 0))
+ self.data['recipes'].append((name, signature, 'Recipe', self.env.docname, anchor, 0))
-def setup(app):
+def setup(app: Sphinx) -> ExtensionMetadata:
app.add_domain(RecipeDomain)
return {
diff --git a/doc/development/tutorials/examples/todo.py b/doc/development/tutorials/examples/todo.py
index 15368f4..2baac5c 100644
--- a/doc/development/tutorials/examples/todo.py
+++ b/doc/development/tutorials/examples/todo.py
@@ -1,8 +1,10 @@
from docutils import nodes
from docutils.parsers.rst import Directive
+from sphinx.application import Sphinx
from sphinx.locale import _
from sphinx.util.docutils import SphinxDirective
+from sphinx.util.typing import ExtensionMetadata
class todo(nodes.Admonition, nodes.Element):
@@ -22,13 +24,11 @@ def depart_todo_node(self, node):
class TodolistDirective(Directive):
-
def run(self):
return [todolist('')]
class TodoDirective(SphinxDirective):
-
# this enables content in the directive
has_content = True
@@ -57,8 +57,7 @@ def purge_todos(app, env, docname):
if not hasattr(env, 'todo_all_todos'):
return
- env.todo_all_todos = [todo for todo in env.todo_all_todos
- if todo['docname'] != docname]
+ env.todo_all_todos = [todo for todo in env.todo_all_todos if todo['docname'] != docname]
def merge_todos(app, env, docnames, other):
@@ -90,37 +89,40 @@ def process_todo_nodes(app, doctree, fromdocname):
for todo_info in env.todo_all_todos:
para = nodes.paragraph()
filename = env.doc2path(todo_info['docname'], base=None)
- description = (
- _('(The original entry is located in %s, line %d and can be found ') %
- (filename, todo_info['lineno']))
+ description = _(
+ '(The original entry is located in %s, line %d and can be found '
+ ) % (filename, todo_info['lineno'])
para += nodes.Text(description)
# Create a reference
newnode = nodes.reference('', '')
innernode = nodes.emphasis(_('here'), _('here'))
newnode['refdocname'] = todo_info['docname']
- newnode['refuri'] = app.builder.get_relative_uri(
- fromdocname, todo_info['docname'])
+ newnode['refuri'] = app.builder.get_relative_uri(fromdocname, todo_info['docname'])
newnode['refuri'] += '#' + todo_info['target']['refid']
newnode.append(innernode)
para += newnode
para += nodes.Text('.)')
# Insert into the todolist
- content.append(todo_info['todo'])
- content.append(para)
+ content.extend((
+ todo_info['todo'],
+ para,
+ ))
node.replace_self(content)
-def setup(app):
+def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value('todo_include_todos', False, 'html')
app.add_node(todolist)
- app.add_node(todo,
- html=(visit_todo_node, depart_todo_node),
- latex=(visit_todo_node, depart_todo_node),
- text=(visit_todo_node, depart_todo_node))
+ app.add_node(
+ todo,
+ html=(visit_todo_node, depart_todo_node),
+ latex=(visit_todo_node, depart_todo_node),
+ text=(visit_todo_node, depart_todo_node),
+ )
app.add_directive('todo', TodoDirective)
app.add_directive('todolist', TodolistDirective)
diff --git a/doc/development/tutorials/recipe.rst b/doc/development/tutorials/recipe.rst
index 1ed428a..683cc8c 100644
--- a/doc/development/tutorials/recipe.rst
+++ b/doc/development/tutorials/recipe.rst
@@ -179,9 +179,9 @@ hook the various parts of our extension into Sphinx. Let's look at the
This looks a little different to what we're used to seeing. There are no calls
to :meth:`~Sphinx.add_directive` or even :meth:`~Sphinx.add_role`. Instead, we
have a single call to :meth:`~Sphinx.add_domain` followed by some
-initialization of the :ref:`standard domain <domains-std>`. This is because we
-had already registered our directives, roles and indexes as part of the
-directive itself.
+initialization of the :doc:`standard domain </usage/domains/standard>`.
+This is because we had already registered our directives,
+roles and indexes as part of the directive itself.
Using the extension
diff --git a/doc/examples.rst b/doc/examples.rst
index c28364a..492752a 100644
--- a/doc/examples.rst
+++ b/doc/examples.rst
@@ -2,4 +2,4 @@
.. _examples:
-.. include:: ../EXAMPLES
+.. include:: ../EXAMPLES.rst
diff --git a/doc/extdev/appapi.rst b/doc/extdev/appapi.rst
index 270000b..10d030b 100644
--- a/doc/extdev/appapi.rst
+++ b/doc/extdev/appapi.rst
@@ -443,6 +443,9 @@ The Config object
.. autoclass:: Config
+.. py:class:: ENUM
+ :no-typesetting:
+
.. _template-bridge:
diff --git a/doc/extdev/deprecated.rst b/doc/extdev/deprecated.rst
index f90389c..1476ce8 100644
--- a/doc/extdev/deprecated.rst
+++ b/doc/extdev/deprecated.rst
@@ -22,6 +22,20 @@ The following is a list of deprecated interfaces.
- Removed
- Alternatives
+ * - ``sphinx.testing.util.strip_escseq``
+ - 7.3
+ - 9.0
+ - ``sphinx.util.console.strip_colors``
+
+ * - Old-style Makefiles in ``sphinx-quickstart``
+ and the :option:`!-M`, :option:`!-m`, :option:`!--no-use-make-mode`,
+ and :option:`!--use-make-mode` options
+ - 7.3
+ - 9.0
+ - Vendoring the `old style Makefile templates`__
+
+ __ https://github.com/sphinx-doc/sphinx/blob/v7.0.0/sphinx/templates/quickstart/Makefile_t
+
* - ``sphinx.ext.autodoc.preserve_defaults.get_function_def()``
- 7.2
- 9.0
diff --git a/doc/extdev/i18n.rst b/doc/extdev/i18n.rst
index 6b32b8b..c5ffc84 100644
--- a/doc/extdev/i18n.rst
+++ b/doc/extdev/i18n.rst
@@ -18,8 +18,8 @@ i18n API
.. _ext-i18n:
-Extension internationalization (`i18n`) and localization (`l10n`) using i18n API
---------------------------------------------------------------------------------
+Extension internationalization (``i18n``) and localization (``l10n``) using i18n API
+------------------------------------------------------------------------------------
.. versionadded:: 1.8
diff --git a/doc/extdev/nodes.rst b/doc/extdev/nodes.rst
index 7603763..f17c28e 100644
--- a/doc/extdev/nodes.rst
+++ b/doc/extdev/nodes.rst
@@ -44,7 +44,7 @@ to ``docutils.nodes.inline`` by :py:class:`!SigElementFallbackTransform`.
Extensions may create additional ``desc_sig_*``-like nodes but in order for
:py:class:`!SigElementFallbackTransform` to translate them to inline nodes
automatically, they must be added to :py:data:`SIG_ELEMENTS` via the class
-keyword argument `_sig_element=True` of :py:class:`desc_sig_element`, e.g.:
+keyword argument ``_sig_element=True`` of :py:class:`desc_sig_element`, e.g.:
.. code-block:: python
diff --git a/doc/extdev/utils.rst b/doc/extdev/utils.rst
index e842f30..ff8dc4e 100644
--- a/doc/extdev/utils.rst
+++ b/doc/extdev/utils.rst
@@ -35,3 +35,9 @@ Utility components
.. autoclass:: sphinx.events.EventManager
:members:
+
+Utility types
+-------------
+
+.. autoclass:: sphinx.util.typing.ExtensionMetadata
+ :members:
diff --git a/doc/faq.rst b/doc/faq.rst
index 85ccb24..8538cdc 100644
--- a/doc/faq.rst
+++ b/doc/faq.rst
@@ -107,7 +107,7 @@ Google Analytics
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
- 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ 'https://ssl' : 'https://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
diff --git a/doc/glossary.rst b/doc/glossary.rst
index e58ce6b..85e0057 100644
--- a/doc/glossary.rst
+++ b/doc/glossary.rst
@@ -59,7 +59,7 @@ Glossary
means that extensions that support the documentation of whole new
languages are much easier to write.
- For more information, refer to :doc:`/usage/restructuredtext/domains`.
+ For more information, refer to :doc:`/usage/domains/index`.
environment
A structure where information about all documents under the root is saved,
diff --git a/doc/index.rst b/doc/index.rst
index e9aea1c..6dfdb6d 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -21,7 +21,7 @@ Here are some of Sphinx's major features:
<builtin-extensions>`, and much more functionality via :ref:`third-party
extensions <third-party-extensions>`.
* **Themes:** modify the look and feel of outputs via :doc:`creating themes
- <development/theming>`, and re-use many :ref:`third-party themes
+ <development/theming>`, and reuse many :ref:`third-party themes
<third-party-themes>`.
* **Contributed extensions:** dozens of extensions :ref:`contributed by users
<third-party-extensions>`; most of them installable from PyPI.
diff --git a/doc/internals/code-of-conduct.rst b/doc/internals/code-of-conduct.rst
index 8e31ef0..c7e2e34 100644
--- a/doc/internals/code-of-conduct.rst
+++ b/doc/internals/code-of-conduct.rst
@@ -2,4 +2,4 @@
.. _code_of_conduct:
-.. include:: ../../CODE_OF_CONDUCT
+.. include:: ../../CODE_OF_CONDUCT.rst
diff --git a/doc/internals/contributing.rst b/doc/internals/contributing.rst
index 195f6a5..207374e 100644
--- a/doc/internals/contributing.rst
+++ b/doc/internals/contributing.rst
@@ -114,7 +114,7 @@ These are the basic steps needed to start developing on Sphinx.
Write your code along with tests that shows that the bug was fixed or that
the feature works as expected.
-#. Add a bullet point to :file:`CHANGES` if the fix or feature is not trivial
+#. Add a bullet point to :file:`CHANGES.rst` if the fix or feature is not trivial
(small doc updates, typo fixes), then commit::
git commit -m '#42: Add useful new feature that does this.'
@@ -142,7 +142,7 @@ Please follow these guidelines when writing code for Sphinx:
* Try to use the same code style as used in the rest of the project.
-* For non-trivial changes, please update the :file:`CHANGES` file. If your
+* For non-trivial changes, please update the :file:`CHANGES.rst` file. If your
changes alter existing behavior, please document this.
* New features should be documented. Include examples and use cases where
@@ -197,6 +197,14 @@ To run JavaScript tests, use ``npm``::
npm install
npm run test
+.. tip::
+
+ ``karma`` requires a Firefox binary to use as a test browser.
+
+ For Unix-based systems, you can specify the path to the Firefox binary using::
+
+ FIREFOX_BIN="/Applications/Firefox.app/Contents/MacOS/firefox" npm test
+
New unit tests should be included in the ``tests`` directory where
necessary:
diff --git a/doc/internals/organization.rst b/doc/internals/organization.rst
index 9dec923..8ca1446 100644
--- a/doc/internals/organization.rst
+++ b/doc/internals/organization.rst
@@ -24,7 +24,7 @@ The following are some general guidelines for core developers:
in a good working state and that all tests pass before pushing your changes.
* When committing code written by someone else, please attribute the original
- author in the commit message and any relevant :file:`CHANGES` entry.
+ author in the commit message and any relevant :file:`CHANGES.rst` entry.
Membership
~~~~~~~~~~
diff --git a/doc/internals/release-process.rst b/doc/internals/release-process.rst
index 50648cd..5d14c44 100644
--- a/doc/internals/release-process.rst
+++ b/doc/internals/release-process.rst
@@ -117,9 +117,11 @@ Date Python
05 Apr 2024 3.10+
----------- ------
04 Apr 2025 3.11+
+----------- ------
+24 Apr 2026 3.12+
=========== ======
Release procedures
------------------
-The release procedures are listed in ``utils/release-checklist``.
+The release procedures are listed in :file:`utils/release-checklist.rst`.
diff --git a/doc/latex.rst b/doc/latex.rst
index 4c9a4e0..0101b24 100644
--- a/doc/latex.rst
+++ b/doc/latex.rst
@@ -377,7 +377,7 @@ Keys that don't need to be overridden unless in special cases are:
.. versionchanged:: 2.0
``'lualatex'`` executes
``\defaultfontfeatures[\rmfamily,\sffamily]{}`` to disable TeX
- ligatures transforming `<<` and `>>` as escaping working with
+ ligatures transforming ``<<`` and ``>>`` as escaping working with
``pdflatex/xelatex`` failed with ``lualatex``.
.. versionchanged:: 2.0
@@ -484,7 +484,7 @@ Keys that don't need to be overridden unless in special cases are:
.. versionchanged:: 1.8.3
Original ``\maketitle`` from document class is not overwritten,
- hence is re-usable as part of some custom setting for this key.
+ hence is reusable as part of some custom setting for this key.
.. versionadded:: 1.8.3
``\sphinxbackoftitlepage`` optional macro. It can also be defined
diff --git a/doc/man/sphinx-build.rst b/doc/man/sphinx-build.rst
index a1fb9be..8be2780 100644
--- a/doc/man/sphinx-build.rst
+++ b/doc/man/sphinx-build.rst
@@ -20,7 +20,7 @@ files, including ``conf.py``.
format is selected by specifying the builder name on the command line; it
defaults to HTML. Builders can also perform other tasks related to
documentation processing. For a list of available builders, refer to
-:option:`sphinx-build -b`.
+:doc:`/usage/builders/index`.
By default, everything that is outdated is built. Output only for selected
files can be built by specifying individual filenames.
@@ -30,107 +30,87 @@ Options
.. program:: sphinx-build
-.. option:: -b buildername
-
- The most important option: it selects 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.
+.. _make_mode:
- **xml**
- Build Docutils-native XML files.
+.. option:: -M buildername
- **pseudoxml**
- Build compact pretty-printed "pseudo-XML" files displaying the
- internal structure of the intermediate document trees.
+ Select a builder, using the *make-mode*.
+ See :doc:`/usage/builders/index` for a list of all of Sphinx's built-in builders.
+ Extensions can add their own builders.
- See :doc:`/usage/builders/index` for a list of all builders shipped with
- Sphinx. Extensions can add their own builders.
+ .. important::
+ Sphinx only recognizes the ``-M`` option if it is used first, along with
+ the source and output directories, before any other options are passed.
+ For example::
-.. _make_mode:
+ sphinx-build -M html ./source ./build -W --keep-going
-.. option:: -M buildername
+ The *make-mode* provides the same build functionality as
+ a default :ref:`Makefile or Make.bat <makefile_options>`,
+ and provides the following additional build pipelines:
- Alternative to :option:`-b`. Uses the Sphinx :program:`make_mode` module,
- which provides the same build functionality as a default :ref:`Makefile or
- Make.bat <makefile_options>`. In addition to all Sphinx
- :doc:`/usage/builders/index`, the following build pipelines are available:
-
- **latexpdf**
+ *latexpdf*
Build LaTeX files and run them through :program:`pdflatex`, or as per
:confval:`latex_engine` setting.
If :confval:`language` is set to ``'ja'``, will use automatically
the :program:`platex/dvipdfmx` latex to PDF pipeline.
- **info**
+ *info*
Build Texinfo files and run them through :program:`makeinfo`.
- .. important::
- Sphinx only recognizes the ``-M`` option if it is placed first.
+ .. note::
+
+ The default output directory locations when using *make-mode*
+ differ from the defaults when using :option:`-b`.
+
+ * doctrees are saved to ``<outputdir>/doctrees``
+ * output files are saved to ``<outputdir>/<builder name>``
.. versionadded:: 1.2.1
-.. option:: -a
+.. option:: -b buildername, --builder buildername
+
+ Selects a builder.
+
+ See :doc:`/usage/builders/index` for a list of all of Sphinx's built-in builders.
+ Extensions can add their own builders.
+
+ .. versionchanged:: 7.3
+ Add ``--builder`` long option.
+
+.. option:: -a, --write-all
If given, always write all output files. The default is to only write output
files for new and changed source files. (This may not apply to all
builders.)
-.. option:: -E
+ .. note:: This option does not re-read source files.
+ To read and re-process every file,
+ use :option:`--fresh-env` instead.
+
+ .. versionchanged:: 7.3
+ Add ``--write-all`` long option.
+
+.. option:: -E, --fresh-env
Don't use a saved :term:`environment` (the structure caching all
cross-references), but rebuild it completely. The default is to only read
and parse source files that are new or have changed since the last run.
-.. option:: -t tag
+ .. versionchanged:: 7.3
+ Add ``--fresh-env`` long option.
+
+.. option:: -t tag, --tag tag
Define the tag *tag*. This is relevant for :rst:dir:`only` directives that
only include their content if this tag is set.
.. versionadded:: 0.6
-.. option:: -d path
+ .. versionchanged:: 7.3
+ Add ``--tag`` long option.
+
+.. option:: -d path, --doctree-dir path
Since Sphinx has to read and parse all source files before it can write an
output file, the parsed source files are cached as "doctree pickles".
@@ -138,6 +118,9 @@ Options
the build directory; with this option you can select a different cache
directory (the doctrees can be shared between all builders).
+ .. versionchanged:: 7.3
+ Add ``--doctree-dir`` long option.
+
.. option:: -j N, --jobs N
Distribute the build over *N* processes in parallel, to make building on
@@ -154,7 +137,7 @@ Options
.. versionchanged:: 6.2
Add ``--jobs`` long option.
-.. option:: -c path
+.. option:: -c path, --config-dir path
Don't look for the :file:`conf.py` in the source directory, but use the given
configuration directory instead. Note that various other files and paths
@@ -164,13 +147,19 @@ Options
.. versionadded:: 0.3
-.. option:: -C
+ .. versionchanged:: 7.3
+ Add ``--config-dir`` long option.
- Don't look for a configuration file; only take options via the ``-D`` option.
+.. option:: -C, --isolated
+
+ Don't look for a configuration file; only take options via the :option:`--define` option.
.. versionadded:: 0.5
-.. option:: -D setting=value
+ .. versionchanged:: 7.3
+ Add ``--isolated`` long option.
+
+.. option:: -D setting=value, --define setting=value
Override a configuration value set in the :file:`conf.py` file. The value
must be a number, string, list or dictionary value.
@@ -189,18 +178,27 @@ Options
.. versionchanged:: 1.3
The value can now also be a list value.
-.. option:: -A name=value
+ .. versionchanged:: 7.3
+ Add ``--define`` long option.
+
+.. option:: -A name=value, --html-define name=value
Make the *name* assigned to *value* in the HTML templates.
.. versionadded:: 0.5
-.. option:: -n
+ .. versionchanged:: 7.3
+ Add ``--html-define`` long option.
+
+.. option:: -n, --nitpicky
Run in nit-picky mode. Currently, this generates warnings for all missing
references. See the config value :confval:`nitpick_ignore` for a way to
exclude some references as "known missing".
+ .. versionchanged:: 7.3
+ Add ``--nitpicky`` long option.
+
.. option:: -N, --no-color
Do not emit colored output.
@@ -214,32 +212,51 @@ Options
.. versionadded:: 1.6
-.. option:: -v
+.. option:: -v, --verbose
- Increase verbosity (loglevel). This option can be given up to three times
+ Increase verbosity (log-level). This option can be given up to three times
to get more debug logging output. It implies :option:`-T`.
.. versionadded:: 1.2
-.. option:: -q
+ .. versionchanged:: 7.3
+ Add ``--verbose`` long option.
+
+.. option:: -q, --quiet
Do not output anything on standard output, only write warnings and errors to
standard error.
-.. option:: -Q
+ .. versionchanged:: 7.3
+ Add ``--quiet`` long option.
+
+.. option:: -Q, --silent
Do not output anything on standard output, also suppress warnings. Only
errors are written to standard error.
-.. option:: -w file
+ .. versionchanged:: 7.3
+ Add ``--silent`` long option.
+
+.. option:: -w file, --warning-file file
Write warnings (and errors) to the given file, in addition to standard error.
-.. option:: -W
+ .. versionchanged:: 7.3
+
+ ANSI control sequences are stripped when writing to *file*.
+
+ .. versionchanged:: 7.3
+ Add ``--warning-file`` long option.
+
+.. option:: -W, --fail-on-warning
Turn warnings into errors. This means that the build stops at the first
warning and ``sphinx-build`` exits with exit status 1.
+ .. versionchanged:: 7.3
+ Add ``--fail-on-warning`` long option.
+
.. option:: --keep-going
With -W option, keep going processing when getting warnings to the end
@@ -247,7 +264,7 @@ Options
.. versionadded:: 1.8
-.. option:: -T
+.. option:: -T, --show-traceback
Display the full traceback when an unhandled exception occurs. Otherwise,
only a summary is displayed and the traceback information is saved to a file
@@ -255,11 +272,17 @@ Options
.. versionadded:: 1.2
-.. option:: -P
+ .. versionchanged:: 7.3
+ Add ``--show-traceback`` long option.
+
+.. option:: -P, --pdb
(Useful for debugging only.) Run the Python debugger, :mod:`pdb`, if an
unhandled exception occurs while building.
+ .. versionchanged:: 7.3
+ Add ``--pdb`` long option.
+
.. option:: -h, --help, --version
Display usage summary or Sphinx version.
diff --git a/doc/man/sphinx-quickstart.rst b/doc/man/sphinx-quickstart.rst
index d050a29..cc6673d 100644
--- a/doc/man/sphinx-quickstart.rst
+++ b/doc/man/sphinx-quickstart.rst
@@ -130,6 +130,9 @@ Options
.. versionchanged:: 1.5
make-mode is default.
+ .. versionchanged:: 7.3
+ Support for disabling the make-mode will be removed in Sphinx 8.
+
.. option:: --makefile, --no-makefile
Create (or not create) makefile.
diff --git a/doc/support.rst b/doc/support.rst
index b7c6f01..0d349a0 100644
--- a/doc/support.rst
+++ b/doc/support.rst
@@ -12,7 +12,7 @@ mailing list on Google Groups, come to the ``#sphinx-doc`` channel on
Examples of other projects using Sphinx can be found in the :doc:`examples page
<examples>`. A useful tutorial_ has been written by the matplotlib developers.
-.. _tutorial: http://matplotlib.sourceforge.net/sampledoc/
+.. _tutorial: https://matplotlib.sourceforge.net/sampledoc/
There is a translation team in Transifex_ of this documentation, thanks to the
Sphinx document translators.
diff --git a/doc/tutorial/automatic-doc-generation.rst b/doc/tutorial/automatic-doc-generation.rst
index b47673d..8d9c9c9 100644
--- a/doc/tutorial/automatic-doc-generation.rst
+++ b/doc/tutorial/automatic-doc-generation.rst
@@ -160,6 +160,6 @@ originally used the corresponding ``autodoc`` directive, in this case in the
.. note::
The generated files are based on `Jinja2
- templates <https://jinja2docs.readthedocs.io/>`_ that
+ templates <https://jinja.palletsprojects.com/>`_ that
:ref:`can be customized <autosummary-customizing-templates>`,
but that is out of scope for this tutorial.
diff --git a/doc/tutorial/deploying.rst b/doc/tutorial/deploying.rst
index e16abdf..6b7913f 100644
--- a/doc/tutorial/deploying.rst
+++ b/doc/tutorial/deploying.rst
@@ -109,16 +109,11 @@ The quickest way to upload an existing project to GitHub is to:
sources, complicating your workflow.
These steps do not require access to the command line or installing any
-additional software. To learn more, you can:
+additional software. To learn more, read `this quickstart tutorial`_ or
+consult the `official GitHub documentation`_
-- Follow `this interactive GitHub course`_ to learn more about how the GitHub
- interface works.
-- Read `this quickstart tutorial`_ to install extra software on your machine
- and have more flexibility. You can either use the Git command line, or the
- GitHub Desktop application.
-
-.. _this interactive GitHub course: https://lab.github.com/githubtraining/introduction-to-github
.. _this quickstart tutorial: https://docs.github.com/en/get-started/quickstart
+.. _official GitHub documentation: https://docs.github.com/en/get-started
GitLab
~~~~~~
@@ -192,11 +187,11 @@ contents:
permissions:
contents: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Build HTML
uses: ammaraskar/sphinx-action@master
- name: Upload artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/build/html/
diff --git a/doc/tutorial/describing-code.rst b/doc/tutorial/describing-code.rst
index 24fea38..16feb2a 100644
--- a/doc/tutorial/describing-code.rst
+++ b/doc/tutorial/describing-code.rst
@@ -8,7 +8,7 @@ will describe code objects instead.
Sphinx supports documenting code objects in several languages, namely Python,
C, C++, JavaScript, and reStructuredText. Each of them can be documented using
a series of directives and roles grouped by
-:doc:`domain </usage/restructuredtext/domains>`. For the remainder of the
+:doc:`domain </usage/domains/index>`. For the remainder of the
tutorial you will use the Python domain, but all the concepts seen in this
section apply for the other domains as well.
@@ -21,9 +21,9 @@ Documenting Python objects
~~~~~~~~~~~~~~~~~~~~~~~~~~
Sphinx offers several roles and directives to document Python objects,
-all grouped together in :ref:`the Python domain <python-domain>`. For example,
-you can use the :rst:dir:`py:function` directive to document a Python function,
-as follows:
+all grouped together in :doc:`the Python domain </usage/domains/python>`.
+For example, you can use the :rst:dir:`py:function` directive to document
+a Python function, as follows:
.. code-block:: rst
:caption: docs/source/usage.rst
@@ -228,7 +228,7 @@ for easy examination. It is now time to fix the function:
def get_random_ingredients(kind=None):
return ["shells", "gorgonzola", "parsley"]
-And finally, ``make test`` reports success!
+And finally, ``make doctest`` reports success!
For big projects though, this manual approach can become a bit tedious.
In the next section, you will see :doc:`how to automate the
@@ -246,7 +246,7 @@ C, C++, JavaScript, and reStructuredText. Third-party extensions may
define domains for more languages, such as
- `Fortran <https://sphinx-fortran.readthedocs.io>`_,
-- `Julia <http://bastikr.github.io/sphinx-julia>`_, or
+- `Julia <https://bastikr.github.io/sphinx-julia>`_, or
- `PHP <https://github.com/markstory/sphinxcontrib-phpdomain>`_.
For example, to document a C++ type definition, you would use the built-in
diff --git a/doc/tutorial/getting-started.rst b/doc/tutorial/getting-started.rst
index 5cf0b38..678f08d 100644
--- a/doc/tutorial/getting-started.rst
+++ b/doc/tutorial/getting-started.rst
@@ -104,7 +104,7 @@ the documentation as HTML for the first time. To do that, run this command:
.. code-block:: console
- (.venv) $ sphinx-build -b html docs/source/ docs/build/html
+ (.venv) $ sphinx-build -M html docs/source/ docs/build/
And finally, open ``docs/build/html/index.html`` in your browser. You should see
something like this:
diff --git a/doc/usage/advanced/intl.rst b/doc/usage/advanced/intl.rst
index ae6e7dc..e858c3c 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 ``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
diff --git a/doc/usage/advanced/websupport/quickstart.rst b/doc/usage/advanced/websupport/quickstart.rst
index 1cdd23f..e7c2b51 100644
--- a/doc/usage/advanced/websupport/quickstart.rst
+++ b/doc/usage/advanced/websupport/quickstart.rst
@@ -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..9c538ee 100644
--- a/doc/usage/builders/index.rst
+++ b/doc/usage/builders/index.rst
@@ -10,9 +10,62 @@ 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
@@ -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
@@ -300,8 +353,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 +372,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 +453,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
diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst
index d440132..a27107f 100644
--- a/doc/usage/configuration.rst
+++ b/doc/usage/configuration.rst
@@ -228,6 +228,7 @@ General configuration
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.
+ :confval:`exclude_patterns` has priority over :confval:`include_patterns`.
Example patterns:
@@ -292,7 +293,7 @@ General configuration
.. index:: default; domain
primary; domain
- The name of the default :doc:`domain </usage/restructuredtext/domains>`.
+ The name of the default :doc:`domain </usage/domains/index>`.
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
@@ -325,18 +326,26 @@ General configuration
.. versionadded:: 0.5
+.. confval:: show_warning_types
+
+ If ``True``, the type of each warning is added as a suffix to the warning message,
+ e.g., ``WARNING: [...] [index]`` or ``WARNING: [...] [toc.circular]``.
+ The default is ``False``.
+
+ .. versionadded:: 7.3.0
+
.. confval:: suppress_warnings
A list of warning types to suppress arbitrary warning messages.
- Sphinx supports following warning types:
+ Sphinx core supports following warning types:
* ``app.add_node``
* ``app.add_directive``
* ``app.add_role``
* ``app.add_generic_role``
* ``app.add_source_parser``
- * ``autosectionlabel.*``
+ * ``config.cache``
* ``download.not_readable``
* ``epub.unknown_project_files``
* ``epub.duplicated_toc_entry``
@@ -358,11 +367,18 @@ General configuration
* ``toc.not_readable``
* ``toc.secnum``
+ Extensions can also define their own warning types.
+ Those defined by the first-party ``sphinx.ext`` extensions are:
+
+ * ``autodoc``
+ * ``autodoc.import_object``
+ * ``autosectionlabel.<document name>``
+ * ``autosummary``
+ * ``intersphinx.external``
+
You can choose from these types. You can also give only the first
component to exclude all warnings attached to it.
- Now, this option should be considered *experimental*.
-
.. versionadded:: 1.4
.. versionchanged:: 1.5
@@ -379,7 +395,7 @@ General configuration
.. versionchanged:: 2.1
- Added ``autosectionlabel.*``
+ Added ``autosectionlabel.<document name>``
.. versionchanged:: 3.3.0
@@ -393,9 +409,13 @@ General configuration
Added ``i18n.inconsistent_references``
- .. versionadded:: 7.1
+ .. versionadded:: 7.1
- Added ``index`` warning type.
+ Added ``index`` warning type.
+
+ .. versionadded:: 7.3
+
+ Added ``config.cache`` warning type.
.. confval:: needs_sphinx
@@ -1178,7 +1198,7 @@ that use Sphinx's HTMLWriter class.
('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
+ file at an earlier or lazier step. For more information, refer
:meth:`.Sphinx.add_css_file()`.
.. versionadded:: 1.8
@@ -1200,9 +1220,9 @@ that use Sphinx's HTMLWriter class.
'https://example.com/scripts/custom.js',
('custom.js', {'async': 'async'})]
- 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()`.
+ As a special attribute, *priority* can be set as an integer to load the
+ JavaScript file at an earlier or lazier step. For more information, refer
+ :meth:`.Sphinx.add_js_file()`.
.. versionadded:: 1.8
.. versionchanged:: 3.5
@@ -1591,7 +1611,41 @@ that use Sphinx's HTMLWriter class.
The name of a JavaScript file (relative to the configuration directory) that
implements a search results scorer. If empty, the default will be used.
- .. XXX describe interface for scorer here
+ The scorer must implement the following interface,
+ and may optionally define the ``score()`` function for more granular control.
+
+ .. code-block:: javascript
+
+ const Scorer = {
+ // Implement the following function to further tweak the score for each result
+ score: result => {
+ const [docName, title, anchor, descr, score, filename] = result
+
+ // ... 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
@@ -1641,7 +1695,7 @@ Options for Single HTML output
.. confval:: singlehtml_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
+ 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`.
@@ -1963,7 +2017,7 @@ the `Dublin Core metadata <https://dublincore.org/>`_.
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
+ at `<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::
@@ -2366,7 +2420,7 @@ These options influence LaTeX output.
usage). This means that words with UTF-8 characters will get
ordered correctly for the :confval:`language`.
- __ http://xindy.sourceforge.net/
+ __ https://xindy.sourceforge.net/
- This option is ignored if :confval:`latex_engine` is ``'platex'``
(Japanese documents; :program:`mendex` replaces :program:`makeindex`
@@ -2742,7 +2796,7 @@ Options for the linkcheck builder
A list of regular expressions that match URIs that should not be checked
when doing a ``linkcheck`` build. Example::
- linkcheck_ignore = [r'http://localhost:\d+/']
+ linkcheck_ignore = [r'https://localhost:\d+/']
.. versionadded:: 1.1
@@ -2804,8 +2858,8 @@ Options for the linkcheck builder
.. confval:: linkcheck_timeout
- A timeout value, in seconds, for the linkcheck builder. The default is to
- use Python's global socket timeout.
+ The duration, in seconds, that the linkcheck builder will wait for a
+ response after each hyperlink request. Defaults to 30 seconds.
.. versionadded:: 1.1
@@ -2896,7 +2950,8 @@ Options for the linkcheck builder
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.
+ ``linkcheck_rate_limit_timeout``. By default, the timeout is 300 seconds
+ and custom timeouts should be given in seconds.
.. _Retry-After: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3
@@ -2915,6 +2970,33 @@ Options for the linkcheck builder
.. versionadded:: 4.4
+.. confval:: linkcheck_allow_unauthorized
+
+ When a webserver responds with an HTTP 401 (unauthorized) response, the
+ current default behaviour of Sphinx is to treat the link as "working". To
+ change that behaviour, set this option to ``False``.
+
+ 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.
+
+ .. versionadded:: 7.3
+
+.. confval:: linkcheck_report_timeouts_as_broken
+
+ When an HTTP response is not received from a webserver before the configured
+ :confval:`linkcheck_timeout` expires,
+ the current default behaviour of Sphinx 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 ``False``.
+
+ From Sphinx 8.0 onwards, timeouts that occur while checking hyperlinks
+ will be reported using the new 'timeout' status code.
+
+ .. xref RemovedInSphinx80Warning
+
+ .. versionadded:: 7.3
+
Options for the XML builder
---------------------------
@@ -3066,7 +3148,7 @@ 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 ``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
diff --git a/doc/usage/domains/c.rst b/doc/usage/domains/c.rst
new file mode 100644
index 0000000..3c1a41d
--- /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 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
+
+ :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-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..6c9372b
--- /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-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..b5d43ce
--- /dev/null
+++ b/doc/usage/domains/index.rst
@@ -0,0 +1,208 @@
+.. highlight:: rst
+
+=======
+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.
+
+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..630b52e
--- /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-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..96982f1
--- /dev/null
+++ b/doc/usage/domains/python.rst
@@ -0,0 +1,688 @@
+.. 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." 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 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.
+
+ .. 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: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:: 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-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-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()``.
diff --git a/doc/usage/domains/restructuredtext.rst b/doc/usage/domains/restructuredtext.rst
new file mode 100644
index 0000000..3a936a6
--- /dev/null
+++ b/doc/usage/domains/restructuredtext.rst
@@ -0,0 +1,99 @@
+.. highlight:: rst
+
+===========================
+The reStructuredText Domain
+===========================
+
+.. versionadded:: 1.0
+
+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-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 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-contents-entry:
+ :no-index-entry:
+
+ Foo description.
+
+.. _rst-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..59b7e72
--- /dev/null
+++ b/doc/usage/domains/standard.rst
@@ -0,0 +1,95 @@
+.. 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:: .. 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..c920de8 100644
--- a/doc/usage/extensions/autodoc.rst
+++ b/doc/usage/extensions/autodoc.rst
@@ -40,7 +40,7 @@ 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
diff --git a/doc/usage/extensions/coverage.rst b/doc/usage/extensions/coverage.rst
index 1390ebf..b9c493b 100644
--- a/doc/usage/extensions/coverage.rst
+++ b/doc/usage/extensions/coverage.rst
@@ -9,7 +9,7 @@ This extension features one additional builder, the :class:`CoverageBuilder`.
.. class:: CoverageBuilder
To use this builder, activate the coverage extension in your configuration
- file and give ``-b coverage`` on the command line.
+ file and give ``-M coverage`` on the command line.
.. todo:: Write this section.
@@ -62,7 +62,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 +81,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/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..231bd36 100644
--- a/doc/usage/extensions/graphviz.rst
+++ b/doc/usage/extensions/graphviz.rst
@@ -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/intersphinx.rst b/doc/usage/extensions/intersphinx.rst
index 5aaaf9f..e81719f 100644
--- a/doc/usage/extensions/intersphinx.rst
+++ b/doc/usage/extensions/intersphinx.rst
@@ -218,6 +218,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..251d721 100644
--- a/doc/usage/extensions/math.rst
+++ b/doc/usage/extensions/math.rst
@@ -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..13dc6a9 100644
--- a/doc/usage/installation.rst
+++ b/doc/usage/installation.rst
@@ -64,7 +64,7 @@ a Python distribution such as `Anaconda`__.
__ https://brew.sh/
__ https://www.macports.org/
-__ https://www.anaconda.com/download/#macos
+__ https://www.anaconda.com/download
Homebrew
~~~~~~~~
@@ -199,9 +199,7 @@ 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
+.. seealso:: :mod:`venv` -- creating virtual environments
.. warning::
diff --git a/doc/usage/quickstart.rst b/doc/usage/quickstart.rst
index 0773f60..fcbfa80 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
@@ -130,11 +130,11 @@ 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
@@ -220,7 +220,7 @@ 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
+|more| See :doc:`/usage/domains/index` for all the available domains
and their directives/roles.
diff --git a/doc/usage/referencing.rst b/doc/usage/referencing.rst
new file mode 100644
index 0000000..c2ad715
--- /dev/null
+++ b/doc/usage/referencing.rst
@@ -0,0 +1,258 @@
+.. _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::
+
+ 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 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
+ :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
+ 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.
diff --git a/doc/usage/restructuredtext/basics.rst b/doc/usage/restructuredtext/basics.rst
index cc3c615..7aab544 100644
--- a/doc/usage/restructuredtext/basics.rst
+++ b/doc/usage/restructuredtext/basics.rst
@@ -289,7 +289,7 @@ information.
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
diff --git a/doc/usage/restructuredtext/directives.rst b/doc/usage/restructuredtext/directives.rst
index 1fd5b66..ff42524 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::
@@ -323,6 +323,18 @@ units as well as normal text.
.. deprecated:: 3.1
Use :func:`spam` instead.
+.. rst:directive:: .. versionremoved:: version
+
+ Similar to :rst:dir:`versionadded`, but describes when the feature was removed.
+ An explanation may be provided to inform the reader what to use instead,
+ or why the feature was removed.
+ Example::
+
+ .. versionremoved:: 4.0
+ The :func:`spam` function is more flexible, and should be used instead.
+
+ .. versionadded:: 7.3
+
.. rst:directive:: seealso
Many sections include a list of references to module documentation or
@@ -341,7 +353,7 @@ units as well as normal text.
Module :py:mod:`zipfile`
Documentation of the :py:mod:`zipfile` standard module.
- `GNU tar manual, Basic Tar Format <http://link>`_
+ `GNU tar manual, Basic Tar Format <https://link>`_
Documentation for tar archive files, including GNU tar extensions.
There's also a "short form" allowed that looks like this::
@@ -544,9 +556,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 +588,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
@@ -881,7 +893,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
@@ -1042,7 +1054,7 @@ Including content based on tags
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
+ expressions, also using parentheses (like ``(latex or html) and draft``) are
supported.
The *format* and the *name* of the current builder (``html``, ``latex`` or
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..62dad5c 100644
--- a/doc/usage/restructuredtext/field-lists.rst
+++ b/doc/usage/restructuredtext/field-lists.rst
@@ -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..0fe311e 100644
--- a/doc/usage/restructuredtext/index.rst
+++ b/doc/usage/restructuredtext/index.rst
@@ -21,4 +21,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..b21a2b7 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.
@@ -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..be46cab 100644
--- a/doc/usage/theming.rst
+++ b/doc/usage/theming.rst
@@ -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
@@ -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