mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge remote-tracking branch 'stephenfin/doc-rework'
This commit is contained in:
commit
1140e81df7
@ -12,16 +12,16 @@ Sphinx documentation contents
|
|||||||
usage/restructuredtext/index
|
usage/restructuredtext/index
|
||||||
usage/markdown
|
usage/markdown
|
||||||
usage/configuration
|
usage/configuration
|
||||||
|
usage/builders/index
|
||||||
|
usage/extensions/index
|
||||||
|
|
||||||
intro
|
intro
|
||||||
man/index
|
man/index
|
||||||
builders
|
|
||||||
intl
|
intl
|
||||||
theming
|
theming
|
||||||
setuptools
|
setuptools
|
||||||
templating
|
templating
|
||||||
latex
|
latex
|
||||||
extensions
|
|
||||||
extdev/index
|
extdev/index
|
||||||
websupport
|
websupport
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
Builtin Sphinx extensions
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
These extensions are built in and can be activated by respective entries in the
|
|
||||||
:confval:`extensions` configuration value:
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
|
|
||||||
autodoc
|
|
||||||
autosectionlabel
|
|
||||||
autosummary
|
|
||||||
coverage
|
|
||||||
doctest
|
|
||||||
extlinks
|
|
||||||
githubpages
|
|
||||||
graphviz
|
|
||||||
ifconfig
|
|
||||||
imgconverter
|
|
||||||
inheritance
|
|
||||||
intersphinx
|
|
||||||
linkcode
|
|
||||||
math
|
|
||||||
napoleon
|
|
||||||
todo
|
|
||||||
viewcode
|
|
@ -1,16 +0,0 @@
|
|||||||
.. _extensions:
|
|
||||||
|
|
||||||
Sphinx Extensions
|
|
||||||
=================
|
|
||||||
|
|
||||||
Since many projects will need special features in their documentation, Sphinx
|
|
||||||
allows adding "extensions" to the build process, each of which can modify almost
|
|
||||||
any aspect of document processing.
|
|
||||||
|
|
||||||
This chapter describes the extensions bundled with Sphinx. For the API
|
|
||||||
documentation on writing your own extension, see :ref:`dev-extensions`.
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
|
|
||||||
ext/builtins
|
|
||||||
ext/thirdparty
|
|
@ -12,7 +12,8 @@ Glossary
|
|||||||
use the builder builders that e.g. check for broken links in the
|
use the builder builders that e.g. check for broken links in the
|
||||||
documentation, or build coverage information.
|
documentation, or build coverage information.
|
||||||
|
|
||||||
See :ref:`builders` for an overview over Sphinx's built-in builders.
|
See :doc:`/usage/builders/index` for an overview over Sphinx's built-in
|
||||||
|
builders.
|
||||||
|
|
||||||
configuration directory
|
configuration directory
|
||||||
The directory containing :file:`conf.py`. By default, this is the same as
|
The directory containing :file:`conf.py`. By default, this is the same as
|
||||||
@ -66,6 +67,12 @@ Glossary
|
|||||||
parsing stage, so that successive runs only need to read and parse new and
|
parsing stage, so that successive runs only need to read and parse new and
|
||||||
changed documents.
|
changed documents.
|
||||||
|
|
||||||
|
extension
|
||||||
|
A custom :term:`role`, :term:`directive` or other aspect of Sphinx that
|
||||||
|
allows users to modify any aspect of the build process within Sphinx.
|
||||||
|
|
||||||
|
For more information, refer to :doc:`/usage/extensions/index`.
|
||||||
|
|
||||||
master document
|
master document
|
||||||
The document that contains the root :rst:dir:`toctree` directive.
|
The document that contains the root :rst:dir:`toctree` directive.
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ Options
|
|||||||
Build compact pretty-printed "pseudo-XML" files displaying the
|
Build compact pretty-printed "pseudo-XML" files displaying the
|
||||||
internal structure of the intermediate document trees.
|
internal structure of the intermediate document trees.
|
||||||
|
|
||||||
See :ref:`builders` for a list of all builders shipped with Sphinx.
|
See :doc:`/usage/builders/index` for a list of all builders shipped with
|
||||||
Extensions can add their own builders.
|
Sphinx. Extensions can add their own builders.
|
||||||
|
|
||||||
.. _make_mode:
|
.. _make_mode:
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ Options
|
|||||||
Alternative to :option:`-b`. Uses the Sphinx :program:`make_mode` module,
|
Alternative to :option:`-b`. Uses the Sphinx :program:`make_mode` module,
|
||||||
which provides the same build functionality as a default :ref:`Makefile or
|
which provides the same build functionality as a default :ref:`Makefile or
|
||||||
Make.bat <makefile_options>`. In addition to all Sphinx
|
Make.bat <makefile_options>`. In addition to all Sphinx
|
||||||
:ref:`builders <builders>`, the following build pipelines are available:
|
:doc:`/usage/builders/index`, the following build pipelines are available:
|
||||||
|
|
||||||
**latexpdf**
|
**latexpdf**
|
||||||
Build LaTeX files and run them through :program:`pdflatex`, or as per
|
Build LaTeX files and run them through :program:`pdflatex`, or as per
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
.. _builders:
|
.. _builders:
|
||||||
|
|
||||||
Available builders
|
========
|
||||||
==================
|
Builders
|
||||||
|
========
|
||||||
|
|
||||||
.. module:: sphinx.builders
|
.. module:: sphinx.builders
|
||||||
:synopsis: Available built-in builder classes.
|
:synopsis: Available built-in builder classes.
|
||||||
|
|
||||||
These are the built-in Sphinx builders. More builders can be added by
|
These are the built-in Sphinx builders. More builders can be added by
|
||||||
:ref:`extensions <extensions>`.
|
: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 **-b** command-line option of
|
||||||
:program:`sphinx-build` to select a builder.
|
:program:`sphinx-build` to select a builder.
|
||||||
@ -75,8 +76,8 @@ The builder's "name" must be given to the **-b** command-line option of
|
|||||||
.. class:: QtHelpBuilder
|
.. class:: QtHelpBuilder
|
||||||
|
|
||||||
This builder produces the same output as the standalone HTML builder, but
|
This builder produces the same output as the standalone HTML builder, but
|
||||||
also generates `Qt help`_ collection support files that allow
|
also generates `Qt help`_ collection support files that allow the Qt
|
||||||
the Qt collection generator to compile them.
|
collection generator to compile them.
|
||||||
|
|
||||||
.. autoattribute:: name
|
.. autoattribute:: name
|
||||||
|
|
||||||
@ -144,7 +145,8 @@ The builder's "name" must be given to the **-b** command-line option of
|
|||||||
|
|
||||||
.. versionchanged:: 1.5
|
.. versionchanged:: 1.5
|
||||||
|
|
||||||
Since Sphinx-1.5, the epub3 builder is used for the default builder of epub.
|
Since Sphinx-1.5, the epub3 builder is used for the default builder of
|
||||||
|
epub.
|
||||||
|
|
||||||
.. module:: sphinx.builders.latex
|
.. module:: sphinx.builders.latex
|
||||||
.. class:: LaTeXBuilder
|
.. class:: LaTeXBuilder
|
||||||
@ -159,12 +161,12 @@ The builder's "name" must be given to the **-b** command-line option of
|
|||||||
in a "minimal" TeX distribution installation. For example, on Ubuntu, the
|
in a "minimal" TeX distribution installation. For example, on Ubuntu, the
|
||||||
following packages need to be installed for successful PDF builds:
|
following packages need to be installed for successful PDF builds:
|
||||||
|
|
||||||
* texlive-latex-recommended
|
* ``texlive-latex-recommended``
|
||||||
* texlive-fonts-recommended
|
* ``texlive-fonts-recommended``
|
||||||
* texlive-latex-extra
|
* ``texlive-latex-extra``
|
||||||
* latexmk (for ``make latexpdf`` on GNU/Linux and MacOS X)
|
* ``latexmk`` (for ``make latexpdf`` on GNU/Linux and MacOS X)
|
||||||
* latex-xcolor (old Ubuntu)
|
* ``latex-xcolor`` (old Ubuntu)
|
||||||
* texlive-luatex, texlive-xetex (see :confval:`latex_engine`)
|
* ``texlive-luatex``, ``texlive-xetex`` (see :confval:`latex_engine`)
|
||||||
|
|
||||||
The testing of Sphinx LaTeX is done on Ubuntu trusty with the above
|
The testing of Sphinx LaTeX is done on Ubuntu trusty with the above
|
||||||
mentioned packages, which are from a TeXLive 2013 snapshot dated
|
mentioned packages, which are from a TeXLive 2013 snapshot dated
|
||||||
@ -178,7 +180,7 @@ The builder's "name" must be given to the **-b** command-line option of
|
|||||||
Since 1.6, ``make latexpdf`` uses ``latexmk`` (not on Windows). This
|
Since 1.6, ``make latexpdf`` uses ``latexmk`` (not on Windows). This
|
||||||
makes sure the needed number of runs is automatically executed to get
|
makes sure the needed number of runs is automatically executed to get
|
||||||
the cross-references, bookmarks, indices, and tables of contents right.
|
the cross-references, bookmarks, indices, and tables of contents right.
|
||||||
|
|
||||||
One can pass to ``latexmk`` options via the ``LATEXMKOPTS``
|
One can pass to ``latexmk`` options via the ``LATEXMKOPTS``
|
||||||
Makefile variable. For example:
|
Makefile variable. For example:
|
||||||
|
|
||||||
@ -311,7 +313,6 @@ name is ``rinoh``. Refer to the `rinohtype manual`_ for details.
|
|||||||
|
|
||||||
The filename for the search index Sphinx generates.
|
The filename for the search index Sphinx generates.
|
||||||
|
|
||||||
|
|
||||||
See :ref:`serialization-details` for details about the output format.
|
See :ref:`serialization-details` for details about the output format.
|
||||||
|
|
||||||
.. versionadded:: 0.5
|
.. versionadded:: 0.5
|
@ -65,8 +65,9 @@ General configuration
|
|||||||
|
|
||||||
.. confval:: extensions
|
.. confval:: extensions
|
||||||
|
|
||||||
A list of strings that are module names of :ref:`extensions`. These can be
|
A list of strings that are module names of :doc:`extensions
|
||||||
extensions coming with Sphinx (named ``sphinx.ext.*``) or custom ones.
|
<extensions/index>`. These can be extensions coming with Sphinx (named
|
||||||
|
``sphinx.ext.*``) or custom ones.
|
||||||
|
|
||||||
Note that you can extend :data:`sys.path` within the conf file if your
|
Note that you can extend :data:`sys.path` within the conf file if your
|
||||||
extensions live in another directory -- but make sure you use absolute paths.
|
extensions live in another directory -- but make sure you use absolute paths.
|
||||||
|
@ -405,6 +405,7 @@ There are also new config values that you can set:
|
|||||||
|
|
||||||
.. versionadded:: 1.7
|
.. versionadded:: 1.7
|
||||||
|
|
||||||
|
|
||||||
Docstring preprocessing
|
Docstring preprocessing
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
@ -27,6 +27,7 @@ default. The ``autosectionlabel_prefix_document`` configuration variable can be
|
|||||||
used to make headings which appear multiple times but in different documents
|
used to make headings which appear multiple times but in different documents
|
||||||
unique.
|
unique.
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
@ -25,7 +25,6 @@ The :mod:`sphinx.ext.autosummary` extension does this in two parts:
|
|||||||
These files by default contain only the corresponding
|
These files by default contain only the corresponding
|
||||||
:mod:`sphinx.ext.autodoc` directive, but can be customized with templates.
|
:mod:`sphinx.ext.autodoc` directive, but can be customized with templates.
|
||||||
|
|
||||||
|
|
||||||
.. rst:directive:: autosummary
|
.. rst:directive:: autosummary
|
||||||
|
|
||||||
Insert a table that contains links to documented items, and a short summary
|
Insert a table that contains links to documented items, and a short summary
|
||||||
@ -59,7 +58,6 @@ The :mod:`sphinx.ext.autosummary` extension does this in two parts:
|
|||||||
:event:`autodoc-process-docstring` and :event:`autodoc-process-signature`
|
:event:`autodoc-process-docstring` and :event:`autodoc-process-signature`
|
||||||
hooks as :mod:`~sphinx.ext.autodoc`.
|
hooks as :mod:`~sphinx.ext.autodoc`.
|
||||||
|
|
||||||
|
|
||||||
**Options**
|
**Options**
|
||||||
|
|
||||||
* If you want the :rst:dir:`autosummary` table to also serve as a
|
* If you want the :rst:dir:`autosummary` table to also serve as a
|
@ -4,7 +4,6 @@
|
|||||||
.. module:: sphinx.ext.coverage
|
.. module:: sphinx.ext.coverage
|
||||||
:synopsis: Check Python modules and C API for coverage in the documentation.
|
:synopsis: Check Python modules and C API for coverage in the documentation.
|
||||||
|
|
||||||
|
|
||||||
This extension features one additional builder, the :class:`CoverageBuilder`.
|
This extension features one additional builder, the :class:`CoverageBuilder`.
|
||||||
|
|
||||||
.. class:: CoverageBuilder
|
.. class:: CoverageBuilder
|
||||||
@ -14,7 +13,6 @@ This extension features one additional builder, the :class:`CoverageBuilder`.
|
|||||||
|
|
||||||
.. todo:: Write this section.
|
.. todo:: Write this section.
|
||||||
|
|
||||||
|
|
||||||
Several new configuration values can be used to specify what the builder
|
Several new configuration values can be used to specify what the builder
|
||||||
should check:
|
should check:
|
||||||
|
|
@ -165,7 +165,6 @@ a comma-separated list of group names.
|
|||||||
|
|
||||||
Output text.
|
Output text.
|
||||||
|
|
||||||
|
|
||||||
The following is an example for the usage of the directives. The test via
|
The following is an example for the usage of the directives. The test via
|
||||||
:rst:dir:`doctest` and the test via :rst:dir:`testcode` and
|
:rst:dir:`doctest` and the test via :rst:dir:`testcode` and
|
||||||
:rst:dir:`testoutput` are equivalent. ::
|
:rst:dir:`testoutput` are equivalent. ::
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
|
|
||||||
This extension is meant to help with the common pattern of having many external
|
This extension is meant to help with the common pattern of having many external
|
||||||
links that point to URLs on one and the same site, e.g. links to bug trackers,
|
links that point to URLs on one and the same site, e.g. links to bug trackers,
|
||||||
version control web interfaces, or simply subpages in other websites. It does
|
version control web interfaces, or simply subpages in other websites. It does
|
@ -1,5 +1,3 @@
|
|||||||
.. highlight:: rest
|
|
||||||
|
|
||||||
:mod:`sphinx.ext.githubpages` -- Publish HTML docs in GitHub Pages
|
:mod:`sphinx.ext.githubpages` -- Publish HTML docs in GitHub Pages
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
@ -13,7 +13,6 @@ your documents.
|
|||||||
|
|
||||||
It adds these directives:
|
It adds these directives:
|
||||||
|
|
||||||
|
|
||||||
.. rst:directive:: graphviz
|
.. rst:directive:: graphviz
|
||||||
|
|
||||||
Directive to embed graphviz code. The input code for ``dot`` is given as the
|
Directive to embed graphviz code. The input code for ``dot`` is given as the
|
@ -1,28 +1,30 @@
|
|||||||
.. highlight:: rest
|
|
||||||
|
|
||||||
.. _sphinx.ext.imgconverter:
|
.. _sphinx.ext.imgconverter:
|
||||||
|
|
||||||
:mod:`sphinx.ext.imgconverter` -- A reference implementation for image converter using Imagemagick
|
:mod:`sphinx.ext.imgconverter` -- A reference image converter using Imagemagick
|
||||||
==================================================================================================
|
===============================================================================
|
||||||
|
|
||||||
.. module:: sphinx.ext.imgconverter
|
.. module:: sphinx.ext.imgconverter
|
||||||
:synopsis: Convert images to appropriate format for builders
|
:synopsis: Convert images to appropriate format for builders
|
||||||
|
|
||||||
.. versionadded:: 1.6
|
.. versionadded:: 1.6
|
||||||
|
|
||||||
This extension converts images in your document to appropriate format for builders.
|
This extension converts images in your document to appropriate format for
|
||||||
For example, it allows you to use SVG images with LaTeX builder.
|
builders. For example, it allows you to use SVG images with LaTeX builder.
|
||||||
As a result, you don't mind what image format the builder supports.
|
As a result, you don't mind what image format the builder supports.
|
||||||
|
|
||||||
Internally, this extension uses Imagemagick_ to convert images.
|
Internally, this extension uses Imagemagick_ to convert images.
|
||||||
|
|
||||||
.. _Imagemagick: https://www.imagemagick.org/script/index.php
|
.. _Imagemagick: https://www.imagemagick.org/script/index.php
|
||||||
|
|
||||||
.. note:: Imagemagick rasterizes a SVG image on conversion. As a result, the image
|
.. note::
|
||||||
becomes not scalable. To avoid that, please use other image converters
|
|
||||||
like sphinxcontrib-svg2pdfconverter_ (which uses Inkscape or rsvg-convert).
|
Imagemagick rasterizes a SVG image on conversion. As a result, the image
|
||||||
|
becomes not scalable. To avoid that, please use other image converters like
|
||||||
|
`sphinxcontrib-svg2pdfconverter`__ (which uses Inkscape or
|
||||||
|
``rsvg-convert``).
|
||||||
|
|
||||||
|
.. __: https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter
|
||||||
|
|
||||||
.. _sphinxcontrib-svg2pdfconverter: https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
@ -1,9 +1,50 @@
|
|||||||
|
==========
|
||||||
|
Extensions
|
||||||
|
==========
|
||||||
|
|
||||||
|
Since many projects will need special features in their documentation, Sphinx
|
||||||
|
allows adding "extensions" to the build process, each of which can modify
|
||||||
|
almost any aspect of document processing.
|
||||||
|
|
||||||
|
This chapter describes the extensions bundled with Sphinx. For the API
|
||||||
|
documentation on writing your own extension, refer to :ref:`dev-extensions`.
|
||||||
|
|
||||||
|
|
||||||
|
Built-in extensions
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
These extensions are built in and can be activated by respective entries in the
|
||||||
|
:confval:`extensions` configuration value:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
|
||||||
|
autodoc
|
||||||
|
autosectionlabel
|
||||||
|
autosummary
|
||||||
|
coverage
|
||||||
|
doctest
|
||||||
|
extlinks
|
||||||
|
githubpages
|
||||||
|
graphviz
|
||||||
|
ifconfig
|
||||||
|
imgconverter
|
||||||
|
inheritance
|
||||||
|
intersphinx
|
||||||
|
linkcode
|
||||||
|
math
|
||||||
|
napoleon
|
||||||
|
todo
|
||||||
|
viewcode
|
||||||
|
|
||||||
|
|
||||||
Third-party extensions
|
Third-party extensions
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
.. todo:: This should reference the GitHub organization now
|
||||||
|
|
||||||
You can find several extensions contributed by users in the `Sphinx Contrib`_
|
You can find several extensions contributed by users in the `Sphinx Contrib`_
|
||||||
repository. It is open for anyone who wants to maintain an extension
|
repository. It is open for anyone who wants to maintain an extension publicly;
|
||||||
publicly; just send a short message asking for write permissions.
|
just send a short message asking for write permissions.
|
||||||
|
|
||||||
There are also several extensions hosted elsewhere. The `Sphinx extension
|
There are also several extensions hosted elsewhere. The `Sphinx extension
|
||||||
survey <https://sphinxext-survey.readthedocs.io/>`__ and `awesome-sphinxdoc
|
survey <https://sphinxext-survey.readthedocs.io/>`__ and `awesome-sphinxdoc
|
||||||
@ -16,15 +57,13 @@ list (`join here <https://groups.google.com/forum/#!forum/sphinx-dev>`_).
|
|||||||
|
|
||||||
.. _Sphinx Contrib: https://bitbucket.org/birkenfeld/sphinx-contrib
|
.. _Sphinx Contrib: https://bitbucket.org/birkenfeld/sphinx-contrib
|
||||||
|
|
||||||
|
|
||||||
Where to put your own extensions?
|
Where to put your own extensions?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Extensions local to a project should be put within the project's directory
|
Extensions local to a project should be put within the project's directory
|
||||||
structure. Set Python's module search path, ``sys.path``, accordingly so that
|
structure. Set Python's module search path, ``sys.path``, accordingly so that
|
||||||
Sphinx can find them.
|
Sphinx can find them. For example, if your extension ``foo.py`` lies in the
|
||||||
E.g., if your extension ``foo.py`` lies in the ``exts`` subdirectory of the
|
``exts`` subdirectory of the project root, put into :file:`conf.py`::
|
||||||
project root, put into :file:`conf.py`::
|
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
|
|
@ -91,7 +91,9 @@ It adds this directive:
|
|||||||
.. versionchanged:: 1.7
|
.. versionchanged:: 1.7
|
||||||
Added ``top-classes`` option to limit the scope of inheritance graphs.
|
Added ``top-classes`` option to limit the scope of inheritance graphs.
|
||||||
|
|
||||||
New config values are:
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
.. confval:: inheritance_graph_attrs
|
.. confval:: inheritance_graph_attrs
|
||||||
|
|
@ -38,8 +38,9 @@ Behind the scenes, this works as follows:
|
|||||||
specified individually, e.g. if the docs should be buildable without Internet
|
specified individually, e.g. if the docs should be buildable without Internet
|
||||||
access.
|
access.
|
||||||
|
|
||||||
Configuring Intersphinx
|
|
||||||
-----------------------
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
To use Intersphinx linking, add ``'sphinx.ext.intersphinx'`` to your
|
To use Intersphinx linking, add ``'sphinx.ext.intersphinx'`` to your
|
||||||
:confval:`extensions` config value, and use these new config values to activate
|
:confval:`extensions` config value, and use these new config values to activate
|
||||||
@ -136,12 +137,14 @@ linking:
|
|||||||
exception is raised if the server has not issued a response for timeout
|
exception is raised if the server has not issued a response for timeout
|
||||||
seconds.
|
seconds.
|
||||||
|
|
||||||
|
|
||||||
Showing all links of an Intersphinx mapping file
|
Showing all links of an Intersphinx mapping file
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
To show all Intersphinx links and their targets of an Intersphinx mapping file, run
|
To show all Intersphinx links and their targets of an Intersphinx mapping file,
|
||||||
``python -msphinx.ext.intersphinx url-or-path``. This is helpful when searching for the root cause of a broken
|
run ``python -msphinx.ext.intersphinx url-or-path``. This is helpful when
|
||||||
Intersphinx link in a documentation project. The following example prints the Intersphinx mapping of the Python 3
|
searching for the root cause of a broken Intersphinx link in a documentation
|
||||||
|
project. The following example prints the Intersphinx mapping of the Python 3
|
||||||
documentation::
|
documentation::
|
||||||
|
|
||||||
$ python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv
|
$ python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv
|
@ -16,6 +16,10 @@ found somewhere on the Internet.
|
|||||||
In your configuration, you need to specify a :confval:`linkcode_resolve`
|
In your configuration, you need to specify a :confval:`linkcode_resolve`
|
||||||
function that returns an URL based on the object.
|
function that returns an URL based on the object.
|
||||||
|
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
.. confval:: linkcode_resolve
|
.. confval:: linkcode_resolve
|
||||||
|
|
||||||
This is a function ``linkcode_resolve(domain, info)``,
|
This is a function ``linkcode_resolve(domain, info)``,
|
@ -1,5 +1,5 @@
|
|||||||
:mod:`sphinx.ext.napoleon` -- Support for NumPy and Google style docstrings
|
:mod:`sphinx.ext.napoleon` -- Support for NumPy and Google style docstrings
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
===========================================================================
|
||||||
|
|
||||||
.. module:: sphinx.ext.napoleon
|
.. module:: sphinx.ext.napoleon
|
||||||
:synopsis: Support for NumPy and Google style docstrings
|
:synopsis: Support for NumPy and Google style docstrings
|
||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
|
|
||||||
Napoleon - *Marching toward legible docstrings*
|
Overview
|
||||||
===============================================
|
--------
|
||||||
|
|
||||||
.. highlight:: text
|
.. highlight:: text
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ Are you tired of writing docstrings that look like this::
|
|||||||
:returns: A buffered writable file descriptor
|
:returns: A buffered writable file descriptor
|
||||||
:rtype: BufferedFileStorage
|
:rtype: BufferedFileStorage
|
||||||
|
|
||||||
`ReStructuredText`_ is great, but it creates visually dense, hard to read
|
`reStructuredText`_ is great, but it creates visually dense, hard to read
|
||||||
`docstrings`_. Compare the jumble above to the same thing rewritten
|
`docstrings`_. Compare the jumble above to the same thing rewritten
|
||||||
according to the `Google Python Style Guide`_::
|
according to the `Google Python Style Guide`_::
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ according to the `Google Python Style Guide`_::
|
|||||||
|
|
||||||
Much more legible, no?
|
Much more legible, no?
|
||||||
|
|
||||||
Napoleon is a :doc:`../extensions` that enables Sphinx to parse both `NumPy`_
|
Napoleon is a :term:`extension` that enables Sphinx to parse both `NumPy`_ and
|
||||||
and `Google`_ style docstrings - the style recommended by `Khan Academy`_.
|
`Google`_ style docstrings - the style recommended by `Khan Academy`_.
|
||||||
|
|
||||||
Napoleon is a pre-processor that parses `NumPy`_ and `Google`_ style
|
Napoleon is a pre-processor that parses `NumPy`_ and `Google`_ style
|
||||||
docstrings and converts them to reStructuredText before Sphinx attempts to
|
docstrings and converts them to reStructuredText before Sphinx attempts to
|
||||||
@ -61,7 +61,7 @@ source code files.
|
|||||||
https://github.com/Khan/style-guides/blob/master/style/python.md#docstrings
|
https://github.com/Khan/style-guides/blob/master/style/python.md#docstrings
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
---------------
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
1. After :doc:`setting up Sphinx </usage/quickstart>` to build your docs,
|
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::
|
||||||
@ -77,7 +77,7 @@ Getting Started
|
|||||||
|
|
||||||
|
|
||||||
Docstrings
|
Docstrings
|
||||||
----------
|
~~~~~~~~~~
|
||||||
|
|
||||||
Napoleon interprets every docstring that :mod:`autodoc <sphinx.ext.autodoc>`
|
Napoleon interprets every docstring that :mod:`autodoc <sphinx.ext.autodoc>`
|
||||||
can find, including docstrings on: ``modules``, ``classes``, ``attributes``,
|
can find, including docstrings on: ``modules``, ``classes``, ``attributes``,
|
||||||
@ -91,7 +91,7 @@ All standard reStructuredText formatting still works as expected.
|
|||||||
.. _Sections:
|
.. _Sections:
|
||||||
|
|
||||||
Docstring Sections
|
Docstring Sections
|
||||||
------------------
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
All of the following section headers are supported:
|
All of the following section headers are supported:
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ All of the following section headers are supported:
|
|||||||
* ``Yields``
|
* ``Yields``
|
||||||
|
|
||||||
Google vs NumPy
|
Google vs NumPy
|
||||||
---------------
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Napoleon supports two styles of docstrings: `Google`_ and `NumPy`_. The
|
Napoleon supports two styles of docstrings: `Google`_ and `NumPy`_. The
|
||||||
main difference between the two styles is that Google uses indention to
|
main difference between the two styles is that Google uses indention to
|
||||||
@ -195,7 +195,7 @@ not be mixed. Choose one style for your project and be consistent with it.
|
|||||||
|
|
||||||
|
|
||||||
Type Annotations
|
Type Annotations
|
||||||
----------------
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
`PEP 484`_ introduced a standard way to express types in Python code.
|
`PEP 484`_ introduced a standard way to express types in Python code.
|
||||||
This is an alternative to expressing types directly in docstrings.
|
This is an alternative to expressing types directly in docstrings.
|
||||||
@ -249,7 +249,7 @@ Google style with types in docstrings::
|
|||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
-------------
|
||||||
|
|
||||||
Listed below are all the settings used by napoleon and their default
|
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
|
values. These settings can be changed in the Sphinx `conf.py` file. Make
|
||||||
@ -278,8 +278,6 @@ sure that "sphinx.ext.napoleon" is enabled in `conf.py`::
|
|||||||
.. _NumPy style:
|
.. _NumPy style:
|
||||||
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
|
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. confval:: napoleon_google_docstring
|
.. confval:: napoleon_google_docstring
|
||||||
|
|
||||||
True to parse `Google style`_ docstrings. False to disable support
|
True to parse `Google style`_ docstrings. False to disable support
|
@ -27,7 +27,10 @@ There are two additional directives when using this extension:
|
|||||||
documentation, if :confval:`todo_include_todos` is ``True``.
|
documentation, if :confval:`todo_include_todos` is ``True``.
|
||||||
|
|
||||||
|
|
||||||
There is also an additional config value:
|
These can be configured as seen below.
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
.. confval:: todo_include_todos
|
.. confval:: todo_include_todos
|
||||||
|
|
@ -7,9 +7,8 @@
|
|||||||
|
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
|
|
||||||
|
This extension looks at your Python object descriptions (``.. class::``, ``..
|
||||||
This extension looks at your Python object descriptions (``.. class::``,
|
function::`` etc.) and tries to find the source files where the objects are
|
||||||
``.. function::`` etc.) and tries to find the source files where the objects are
|
|
||||||
contained. When found, a separate HTML page will be output for each module with
|
contained. When found, a separate HTML page will be output for each module with
|
||||||
a highlighted version of the source code, and a link will be added to all object
|
a highlighted version of the source code, and a link will be added to all object
|
||||||
descriptions that leads to the source code of the described object. A link back
|
descriptions that leads to the source code of the described object. A link back
|
||||||
@ -33,14 +32,15 @@ This extension works only on HTML related builders like ``html``,
|
|||||||
``singlehtml``. By default ``epub`` builder doesn't
|
``singlehtml``. By default ``epub`` builder doesn't
|
||||||
support this extension (see :confval:`viewcode_enable_epub`).
|
support this extension (see :confval:`viewcode_enable_epub`).
|
||||||
|
|
||||||
There is an additional config value:
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
.. confval:: viewcode_follow_imported_members
|
.. confval:: viewcode_follow_imported_members
|
||||||
|
|
||||||
If this is ``True``, viewcode extension will follow alias objects that
|
If this is ``True``, viewcode extension will follow alias objects that
|
||||||
imported from another module such as functions, classes and attributes.
|
imported from another module such as functions, classes and attributes. As
|
||||||
As side effects, this option
|
side effects, this option else they produce nothing. The default is
|
||||||
else they produce nothing. The default is ``True``.
|
``True``.
|
||||||
|
|
||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
|
|
@ -318,12 +318,7 @@ features of intersphinx.
|
|||||||
More topics to be covered
|
More topics to be covered
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
- :doc:`Other extensions </extensions>`:
|
- :doc:`Other extensions </usage/extensions/index>`:
|
||||||
|
|
||||||
* :doc:`/ext/math`,
|
|
||||||
* :doc:`/ext/viewcode`,
|
|
||||||
* :doc:`/ext/doctest`,
|
|
||||||
* ...
|
|
||||||
- Static files
|
- Static files
|
||||||
- :doc:`Selecting a theme </theming>`
|
- :doc:`Selecting a theme </theming>`
|
||||||
- :doc:`/setuptools`
|
- :doc:`/setuptools`
|
||||||
|
@ -444,7 +444,7 @@ candidates. For instance, if the file name ``gnu.*`` was given and two files
|
|||||||
:file:`gnu.pdf` and :file:`gnu.png` existed in the source tree, the LaTeX
|
:file:`gnu.pdf` and :file:`gnu.png` existed in the source tree, the LaTeX
|
||||||
builder would choose the former, while the HTML builder would prefer the
|
builder would choose the former, while the HTML builder would prefer the
|
||||||
latter. Supported image types and choosing priority are defined at
|
latter. Supported image types and choosing priority are defined at
|
||||||
:ref:`builders`.
|
:doc:`/usage/builders/index`.
|
||||||
|
|
||||||
Note that image file names should not contain spaces.
|
Note that image file names should not contain spaces.
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ directory = sphinx/locale/
|
|||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 95
|
max-line-length = 95
|
||||||
ignore = E116,E241,E251,E741,I101
|
ignore = E116,E241,E251,E741,I101
|
||||||
exclude = .git,.tox,.venv,tests/*,build/*,doc/_build/*,sphinx/search/*,doc/ext/example*.py
|
exclude = .git,.tox,.venv,tests/*,build/*,doc/_build/*,sphinx/search/*,doc/usage/extensions/example*.py
|
||||||
application-import-names = sphinx
|
application-import-names = sphinx
|
||||||
import-order-style = smarkets
|
import-order-style = smarkets
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user