2008-03-09 21:32:24 +00:00
|
|
|
.. _extensions:
|
|
|
|
|
|
|
|
|
|
Sphinx Extensions
|
|
|
|
|
=================
|
|
|
|
|
|
2014-01-20 17:21:44 +01:00
|
|
|
Since many projects will need special features in their documentation, Sphinx
|
|
|
|
|
allows to add "extensions" to the build process, each of which can modify almost
|
|
|
|
|
any aspect of document processing.
|
2008-03-09 21:32:24 +00:00
|
|
|
|
2014-01-20 17:21:44 +01:00
|
|
|
This chapter describes the extensions bundled with Sphinx. For the API
|
|
|
|
|
documentation on writing your own extension, see :ref:`dev-extensions`.
|
2008-03-09 21:32:24 +00:00
|
|
|
|
2008-03-12 21:37:22 +00:00
|
|
|
Builtin Sphinx extensions
|
|
|
|
|
-------------------------
|
2008-03-09 21:32:24 +00:00
|
|
|
|
2008-03-12 21:37:22 +00:00
|
|
|
These extensions are built in and can be activated by respective entries in the
|
|
|
|
|
:confval:`extensions` configuration value:
|
2008-03-09 21:32:24 +00:00
|
|
|
|
2008-03-12 21:37:22 +00:00
|
|
|
.. toctree::
|
2008-03-09 21:32:24 +00:00
|
|
|
|
2008-03-16 11:19:26 +00:00
|
|
|
ext/autodoc
|
2009-03-16 01:30:09 +01:00
|
|
|
ext/autosummary
|
2008-03-16 11:19:26 +00:00
|
|
|
ext/doctest
|
2008-08-04 17:31:25 +00:00
|
|
|
ext/intersphinx
|
2008-08-06 13:04:14 +00:00
|
|
|
ext/math
|
2009-03-04 23:52:56 +01:00
|
|
|
ext/graphviz
|
|
|
|
|
ext/inheritance
|
2008-03-16 11:19:26 +00:00
|
|
|
ext/ifconfig
|
|
|
|
|
ext/coverage
|
2008-11-09 19:46:32 +01:00
|
|
|
ext/todo
|
2009-05-02 20:38:45 +02:00
|
|
|
ext/extlinks
|
2010-01-13 23:53:01 +01:00
|
|
|
ext/viewcode
|
2012-03-11 17:48:51 +01:00
|
|
|
ext/linkcode
|
2014-01-18 13:56:23 -05:00
|
|
|
ext/napoleon
|
2008-11-16 13:32:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Third-party extensions
|
|
|
|
|
----------------------
|
|
|
|
|
|
2010-10-10 21:47:03 +02:00
|
|
|
You can find several extensions contributed by users in the `Sphinx Contrib`_
|
|
|
|
|
repository. It is open for anyone who wants to maintain an extension
|
|
|
|
|
publicly; just send a short message asking for write permissions.
|
2010-10-10 20:00:12 +02:00
|
|
|
|
2015-01-02 13:49:38 +01:00
|
|
|
There are also several extensions hosted elsewhere. The `Sphinx extension
|
|
|
|
|
survey <http://sphinxext-survey.readthedocs.org/en/latest/>`__ contains a
|
|
|
|
|
comprehensive list.
|
2008-11-16 13:32:04 +01:00
|
|
|
|
2010-10-10 20:00:12 +02:00
|
|
|
If you write an extension that you think others will find useful or you think
|
|
|
|
|
should be included as a part of Sphinx, please write to the project mailing
|
2014-01-13 00:05:22 +01:00
|
|
|
list (`join here <https://groups.google.com/group/sphinx-dev>`_).
|
2008-12-21 00:10:47 +01:00
|
|
|
|
2014-01-13 00:05:22 +01:00
|
|
|
.. _Sphinx Contrib: https://bitbucket.org/birkenfeld/sphinx-contrib
|
2008-12-21 00:10:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Where to put your own extensions?
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
Sphinx can find them.
|
|
|
|
|
E.g., if your extension ``foo.py`` lies in the ``exts`` subdirectory of the
|
|
|
|
|
project root, put into :file:`conf.py`::
|
|
|
|
|
|
|
|
|
|
import sys, os
|
|
|
|
|
|
|
|
|
|
sys.path.append(os.path.abspath('exts'))
|
|
|
|
|
|
|
|
|
|
extensions = ['foo']
|
|
|
|
|
|
|
|
|
|
You can also install extensions anywhere else on ``sys.path``, e.g. in the
|
|
|
|
|
``site-packages`` directory.
|