Configuration¶
The configuration directory must contain a file named conf.py.
This file (containing Python code) is called the “build configuration file”
and contains (almost) all configuration needed to customize Sphinx input
and output behavior.
An optional file docutils.conf can be added to the configuration directory to adjust Docutils configuration if not otherwise overridden or set by Sphinx.
The configuration file is executed as Python code at build time (using
importlib.import_module(), and with the current directory set to its
containing directory), and therefore can execute arbitrarily complex code.
Sphinx then reads simple names from the file’s namespace as its configuration.
Important points to note:
If not otherwise documented, values must be strings, and their default is the empty string.
The term “fully-qualified name” refers to a string that names an importable Python object inside a module; for example, the FQN
"sphinx.builders.Builder"means theBuilderclass in thesphinx.buildersmodule.Remember that document names use
/as the path separator and don’t contain the file name extension.Since
conf.pyis read as a Python file, the usual rules apply for encodings and Unicode support.The contents of the config namespace are pickled (so that Sphinx can find out when configuration changes), so it may not contain unpickleable values – delete them from the namespace with
delif appropriate. Modules are removed automatically, so you don’t need todelyour imports after use.
Project information¶
- project¶
The documented project’s name.
- author¶
The author name(s) of the document. The default value is
'unknown'.
- copyright¶
A copyright statement in the style
'2008, Author Name'.
- version¶
The major project version, used as the replacement for
|version|. For example, for the Python documentation, this may be something like2.6.
General configuration¶
- extensions¶
A list of strings that are module names of extensions. These can be extensions coming with Sphinx (named
sphinx.ext.*) or custom ones.Note that you can extend
sys.pathwithin the conf file if your extensions live in another directory – but make sure you use absolute paths. If your extension path is relative to the configuration directory, useos.path.abspath()like so:import sys, os sys.path.append(os.path.abspath('sphinxext')) extensions = ['extname']
That way, you can load an extension called
extnamefrom the subdirectorysphinxext.The configuration file itself can be an extension; for that, you only need to provide a
setup()function in it.
- source_suffix¶
The file extensions of source files. Sphinx considers the files with this suffix as sources. The value can be a dictionary mapping file extensions to file types. For example:
source_suffix = { '.rst': 'restructuredtext', '.txt': 'restructuredtext', '.md': 'markdown', }
By default, Sphinx only supports
'restructuredtext'file type. You can add a new file type using source parser extensions. Please read a document of the extension to know which file type the extension supports.The value may also be a list of file extensions: then Sphinx will consider that they all map to the
'restructuredtext'file type.Default is
{'.rst': 'restructuredtext'}.Note
file extensions have to start with a dot (e.g.
.rst).Changed in version 1.3: Can now be a list of extensions.
Changed in version 1.8: Support file type mapping
- source_encoding¶
The encoding of all reST source files. The recommended encoding, and the default value, is
'utf-8-sig'.New in version 0.5: Previously, Sphinx accepted only UTF-8 encoded sources.
- source_parsers¶
If given, a dictionary of parser classes for different source suffices. The keys are the suffix, the values can be either a class or a string giving a fully-qualified name of a parser class. The parser class can be either
docutils.parsers.Parserorsphinx.parsers.Parser. Files with a suffix that is not in the dictionary will be parsed with the default reStructuredText parser.For example:
source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
Note
Refer to Markdown for more information on using Markdown with Sphinx.
New in version 1.3.
Deprecated since version 1.8: Now Sphinx provides an API
Sphinx.add_source_parser()to register a source parser. Please use it instead.- root_doc¶
The document name of the “root” document, that is, the document that contains the root
toctreedirective. Default is'index'.Changed in version 2.0: The default is changed to
'index'from'contents'.Changed in version 4.0: Renamed
root_docfrommaster_doc.
- exclude_patterns¶
A list of glob-style patterns that should be excluded when looking for source files. [1] They are matched against the source file names relative to the source directory, using slashes as directory separators on all platforms.
Example patterns:
'library/xml.rst'– ignores thelibrary/xml.rstfile (replaces entry inunused_docs)'library/xml'– ignores thelibrary/xmldirectory'library/xml*'– ignores all files and directories starting withlibrary/xml'**/.svn'– ignores all.svndirectories
exclude_patternsis also consulted when looking for static files inhtml_static_pathandhtml_extra_path.New in version 1.0.
- templates_path¶
A list of paths that contain extra templates (or templates that overwrite builtin/theme-specific templates). Relative paths are taken as relative to the configuration directory.
Changed in version 1.3: As these files are not meant to be built, they are automatically added to
exclude_patterns.
- template_bridge¶
A string with the fully-qualified name of a callable (or simply a class) that returns an instance of
TemplateBridge. This instance is then used to render HTML documents, and possibly the output of other builders (currently the changes builder). (Note that the template bridge must be made theme-aware if HTML themes are to be used.)
- rst_epilog¶
A string of reStructuredText that will be included at the end of every source file that is read. This is a possible place to add substitutions that should be available in every file (another being
rst_prolog). An example:rst_epilog = """ .. |psf| replace:: Python Software Foundation """
New in version 0.6.
- rst_prolog¶
A string of reStructuredText that will be included at the beginning of every source file that is read. This is a possible place to add substitutions that should be available in every file (another being
rst_epilog). An example:rst_prolog = """ .. |psf| replace:: Python Software Foundation """
New in version 1.0.
- primary_domain¶
The name of the default domain. Can also be
Noneto disable a default domain. The default is'py'. Those objects in other domains (whether the domain name is given explicitly, or selected by adefault-domaindirective) will have the domain name explicitly prepended when named (e.g., when the default domain is C, Python functions will be named “Python function”, not just “function”).New in version 1.0.
- default_role¶
The name of a reST role (builtin or Sphinx extension) to use as the default role, that is, for text marked up
`like this`. This can be set to'py:obj'to make`filter`a cross-reference to the Python function “filter”. The default isNone, which doesn’t reassign the default role.The default role can always be set within individual documents using the standard reST
default-roledirective.New in version 0.4.
- keep_warnings¶
If true, keep warnings as “system message” paragraphs in the built documents. Regardless of this setting, warnings are always written to the standard error stream when
sphinx-buildis run.The default is
False, the pre-0.5 behavior was to always keep them.New in version 0.5.
- suppress_warnings¶
A list of warning types to suppress arbitrary warning messages.
Sphinx supports following warning types:
app.add_nodeapp.add_directiveapp.add_roleapp.add_generic_roleapp.add_source_parserdownload.not_readableimage.not_readableref.termref.refref.numrefref.keywordref.optionref.citationref.footnoteref.docref.pythonmisc.highlighting_failuretoc.circulartoc.excludedtoc.not_readabletoc.secnumepub.unknown_project_filesepub.duplicated_toc_entryautosectionlabel.*
You can choose from these types.
Now, this option should be considered experimental.
New in version 1.4.
Changed in version 1.5: Added
misc.highlighting_failureChanged in version 1.5.1: Added
epub.unknown_project_filesChanged in version 1.6: Added
ref.footnoteChanged in version 2.1: Added
autosectionlabel.*Changed in version 3.3.0: Added
epub.duplicated_toc_entryChanged in version 4.3: Added
toc.excludedandtoc.not_readable
- needs_sphinx¶
If set to a
major.minorversion string like'1.1', Sphinx will compare it with its version and refuse to build if it is too old. Default is no requirement.New in version 1.0.
Changed in version 1.4: also accepts micro version string
- needs_extensions¶
This value can be a dictionary specifying version requirements for extensions in
extensions, e.g.needs_extensions = {'sphinxcontrib.something': '1.5'}. The version strings should be in the formmajor.minor. Requirements do not have to be specified for all extensions, only for those you want to check.This requires that the extension specifies its version to Sphinx (see Developing extensions for Sphinx for how to do that).
New in version 1.3.
- manpages_url¶
A URL to cross-reference
manpagedirectives. If this is defined tohttps://manpages.debian.org/{path}, the:manpage:`man(1)`role will link to <https://manpages.debian.org/man(1)>. The patterns available are:page- the manual page (man)section- the manual section (1)path- the original manual page and section specified (man(1))
This also supports manpages specified as
man.1.Note
This currently affects only HTML writers but could be expanded in the future.
New in version 1.7.
- nitpicky¶
If true, Sphinx will warn about all references where the target cannot be found. Default is
False. You can activate this mode temporarily using the-ncommand-line switch.New in version 1.0.
- nitpick_ignore¶
A list of
(type, target)tuples (by default empty) that should be ignored when generating warnings in “nitpicky mode”. Note thattypeshould include the domain name if present. Example entries would be('py:func', 'int')or('envvar', 'LD_LIBRARY_PATH').New in version 1.1.
- nitpick_ignore_regex¶
An extended version of
nitpick_ignore, which instead interprets thetypeandtargetstrings as regular expressions. Note, that the regular expression must match the whole string (as if the^and$markers were inserted).For example,
(r'py:.*', r'foo.*bar\.B.*')will ignore nitpicky warnings for all python entities that start with'foo'and have'bar.B'in them, such as('py:const', 'foo_package.bar.BAZ_VALUE')or('py:class', 'food.bar.Barman').New in version 4.1.
- numfig¶
If true, figures, tables and code-blocks are automatically numbered if they have a caption. The
numrefrole is enabled. Obeyed so far only by HTML and LaTeX builders. Default isFalse.Note
The LaTeX builder always assigns numbers whether this option is enabled or not.
New in version 1.3.
- numfig_format¶
A dictionary mapping
'figure','table','code-block'and'section'to strings that are used for format of figure numbers. As a special character,%swill be replaced to figure number.Default is to use
'Fig. %s'for'figure','Table %s'for'table','Listing %s'for'code-block'and'Section %s'for'section'.New in version 1.3.
- numfig_secnum_depth¶
if set to
0, figures, tables and code-blocks are continuously numbered starting at1.if
1(default) numbers will bex.1,x.2, … withxthe section number (top level sectioning; nox.if no section). This naturally applies only if section numbering has been activated via the:numbered:option of thetoctreedirective.2means that numbers will bex.y.1,x.y.2, … if located in a sub-section (but stillx.1,x.2, … if located directly under a section and1,2, … if not in any top level section.)etc…
New in version 1.3.
Changed in version 1.7: The LaTeX builder obeys this setting (if
numfigis set toTrue).
- smartquotes¶
If true, the Docutils Smart Quotes transform, originally based on SmartyPants (limited to English) and currently applying to many languages, will be used to convert quotes and dashes to typographically correct entities. Default:
True.New in version 1.6.6: It replaces deprecated
html_use_smartypants. It applies by default to all builders exceptmanandtext(seesmartquotes_excludes.)A docutils.conf file located in the configuration directory (or a global
~/.docutilsfile) is obeyed unconditionally if it deactivates smart quotes via the corresponding Docutils option. But if it activates them, thensmartquotesdoes prevail.
- smartquotes_action¶
This string customizes the Smart Quotes transform. See the file
smartquotes.pyat the Docutils repository for details. The default'qDe'educates normal quote characters",', em- and en-Dashes---,--, and ellipses....New in version 1.6.6.
- smartquotes_excludes¶
This is a
dictwhose default is:{'languages': ['ja'], 'builders': ['man', 'text']}
Each entry gives a sufficient condition to ignore the
smartquotessetting and deactivate the Smart Quotes transform. Accepted keys are as above'builders'or'languages'. The values are lists.Note
Currently, in case of invocation of make with multiple targets, the first target name is the only one which is tested against the
'builders'entry and it decides for all. Also, amake textfollowingmake htmlneeds to be issued in the formmake text O="-E"to force re-parsing of source files, as the cached ones are already transformed. On the other hand the issue does not arise with direct usage of sphinx-build as it caches (in its default usage) the parsed source files in per builder locations.Hint
An alternative way to effectively deactivate (or customize) the smart quotes for a given builder, for example
latex, is to usemakethis way:make latex O="-D smartquotes_action="This can follow some
make htmlwith no problem, in contrast to the situation from the prior note. It requires Docutils 0.14 or later.New in version 1.6.6.
- user_agent¶
A User-Agent of Sphinx. It is used for a header on HTTP access (ex. linkcheck, intersphinx and so on). Default is
"Sphinx/X.Y.Z requests/X.Y.Z python/X.Y.Z".New in version 2.3.
- tls_verify¶
If true, Sphinx verifies server certifications. Default is
True.New in version 1.5.
- tls_cacerts¶
A path to a certification file of CA or a path to directory which contains the certificates. This also allows a dictionary mapping hostname to the path to certificate file. The certificates are used to verify server certifications.
New in version 1.5.
Tip
Sphinx uses requests as a HTTP library internally. Therefore, Sphinx refers a certification file on the directory pointed
REQUESTS_CA_BUNDLEenvironment variable iftls_cacertsnot set.- today¶
- today_fmt¶
These values determine how to format the current date, used as the replacement for
|today|.If you set
todayto a non-empty value, it is used.Otherwise, the current time is formatted using
time.strftime()and the format given intoday_fmt.
The default is now
todayand atoday_fmtof'%b %d, %Y'(or, if translation is enabled withlanguage, an equivalent format for the selected locale).
- highlight_language¶
The default language to highlight source code in. The default is
'default'. It is similar to'python3'; it is mostly a superset of'python'but it fallbacks to'none'without warning if failed.'python3'and other languages will emit warning if failed.The value should be a valid Pygments lexer name, see Showing code examples for more details.
New in version 0.5.
Changed in version 1.4: The default is now
'default'. If you prefer Python 2 only highlighting, you can set it back to'python'.
- highlight_options¶
A dictionary that maps language names to options for the lexer modules of Pygments. These are lexer-specific; for the options understood by each, see the Pygments documentation.
Example:
highlight_options = { 'default': {'stripall': True}, 'php': {'startinline': True}, }
A single dictionary of options are also allowed. Then it is recognized as options to the lexer specified by
highlight_language:# configuration for the ``highlight_language`` highlight_options = {'stripall': True}
New in version 1.3.
Changed in version 3.5: Allow to configure highlight options for multiple languages
- pygments_style¶
The style name to use for Pygments highlighting of source code. If not set, either the theme’s default style or
'sphinx'is selected for HTML output.Changed in version 0.3: If the value is a fully-qualified name of a custom Pygments style class, this is then used as custom style.
- add_function_parentheses¶
A boolean that decides whether parentheses are appended to function and method role text (e.g. the content of
:func:`input`) to signify that the name is callable. Default isTrue.
- add_module_names¶
A boolean that decides whether module names are prepended to all object names (for object types where a “module” of some kind is defined), e.g. for
py:functiondirectives. Default isTrue.
- show_authors¶
A boolean that decides whether
codeauthorandsectionauthordirectives produce any output in the built files.
- modindex_common_prefix¶
A list of prefixes that are ignored for sorting the Python module index (e.g., if this is set to
['foo.'], thenfoo.baris shown underB, notF). This can be handy if you document a project that consists of a single package. Works only for the HTML builder currently. Default is[].New in version 0.6.
- trim_footnote_reference_space¶
Trim spaces before footnote references that are necessary for the reST parser to recognize the footnote, but do not look too nice in the output.
New in version 0.6.
- trim_doctest_flags¶
If true, doctest flags (comments looking like
# doctest: FLAG, ...) at the ends of lines and<BLANKLINE>markers are removed for all code blocks showing interactive Python sessions (i.e. doctests). Default isTrue. See the extensiondoctestfor more possibilities of including doctests.New in version 1.0.
Changed in version 1.1: Now also removes
<BLANKLINE>.
- strip_signature_backslash¶
Default is
False. When backslash stripping is enabled then every occurrence of\\in a domain directive will be changed to\, even within string literals. This was the behaviour before version 3.0, and setting this variable toTruewill reinstate that behaviour.New in version 3.0.
Options for internationalization¶
These options influence Sphinx’s Native Language Support. See the documentation on Internationalization for details.
- language¶
The code for the language the docs are written in. Any text automatically generated by Sphinx will be in that language. Also, Sphinx will try to substitute individual paragraphs from your documents with the translation sets obtained from
locale_dirs. Sphinx will search language-specific figures named byfigure_language_filename(e.g. the German version ofmyfigure.pngwill bemyfigure.de.pngby default setting) and substitute them for original figures. In the LaTeX builder, a suitable language will be selected as an option for the Babel package. Default isNone, which means that no translation will be done.New in version 0.5.
Changed in version 1.4: Support figure substitution
Currently supported languages by Sphinx are:
ar– Arabicbg– Bulgarianbn– Bengalica– Catalancak– Kaqchikelcs– Czechcy– Welshda– Danishde– Germanel– Greeken– Englisheo– Esperantoes– Spanishet– Estonianeu– Basquefa– Iranianfi– Finnishfr– Frenchhe– Hebrewhi– Hindihi_IN– Hindi (India)hr– Croatianhu– Hungarianid– Indonesianit– Italianja– Japaneseko– Koreanlt– Lithuanianlv– Latvianmk– Macedoniannb_NO– Norwegian Bokmalne– Nepalinl– Dutchpl– Polishpt– Portuguesept_BR– Brazilian Portuguesept_PT– European Portuguesero– Romanianru– Russiansi– Sinhalask– Slovaksl– Sloveniansq– Albaniansr– Serbiansr@latin– Serbian (Latin)sr_RS– Serbian (Cyrillic)sv– Swedishta– Tamilte– Telugutr– Turkishuk_UA– Ukrainianur– Urduvi– Vietnamesezh_CN– Simplified Chinesezh_TW– Traditional Chinese
- locale_dirs¶
New in version 0.5.
Directories in which to search for additional message catalogs (see
language), relative to the source directory. The directories on this path are searched by the standardgettextmodule.Internal messages are fetched from a text domain of
sphinx; so if you add the directory./localeto this setting, the message catalogs (compiled from.poformat using msgfmt) must be in./locale/language/LC_MESSAGES/sphinx.mo. The text domain of individual documents depends ongettext_compact.The default is
['locales'].Note
The
-v option for sphinx-build commandis useful to check the locale_dirs config works as expected. It emits debug messages if message catalog directory not found.Changed in version 1.5: Use
localesdirectory as a default value- gettext_allow_fuzzy_translations¶
If true, “fuzzy” messages in the message catalogs are used for translation. The default is
False.New in version 4.3.
- gettext_compact¶
New in version 1.1.
If true, a document’s text domain is its docname if it is a top-level project file and its very base directory otherwise.
If set to string, all document’s text domain is this string, making all documents use single text domain.
By default, the document
markup/code.rstends up in themarkuptext domain. With this option set toFalse, it ismarkup/code.Changed in version 3.3: The string value is now accepted.
- gettext_uuid¶
If true, Sphinx generates uuid information for version tracking in message catalogs. It is used for:
Add uid line for each msgids in .pot files.
Calculate similarity between new msgids and previously saved old msgids. This calculation takes a long time.
If you want to accelerate the calculation, you can use
python-levenshtein3rd-party package written in C by using pip install python-levenshtein.The default is
False.New in version 1.3.
- gettext_location¶
If true, Sphinx generates location information for messages in message catalogs.
The default is
True.New in version 1.3.
- gettext_auto_build¶
If true, Sphinx builds mo file for each translation catalog files.
The default is
True.New in version 1.3.
- gettext_additional_targets¶
To specify names to enable gettext extracting and translation applying for i18n additionally. You can specify below names:
- Index:
index terms
- Literal-block:
literal blocks (
::annotation andcode-blockdirective)- Doctest-block:
doctest block
- Raw:
raw content
- Image:
image/figure uri
For example:
gettext_additional_targets = ['literal-block', 'image'].The default is
[].New in version 1.3.
Changed in version 4.0: The alt text for image is translated by default.
- figure_language_filename¶
The filename format for language-specific figures. The default value is
{root}.{language}{ext}. It will be expanded todirname/filename.en.pngfrom.. image:: dirname/filename.png. The available format tokens are:{root}- the filename, including any path component, without the file extension, e.g.dirname/filename{path}- the directory path component of the filename, with a trailing slash if non-empty, e.g.dirname/{docpath}- the directory path component for the current document, with a trailing slash if non-empty.{basename}- the filename without the directory path or file extension components, e.g.filename{ext}- the file extension, e.g..png{language}- the translation language, e.g.en
For example, setting this to
{path}{language}/{basename}{ext}will expand todirname/en/filename.pnginstead.New in version 1.4.
Changed in version 1.5: Added
{path}and{basename}tokens.Changed in version 3.2: Added
{docpath}token.
Options for Math¶
These options influence Math notations.
- math_number_all¶
Set this option to
Trueif you want all displayed math to be numbered. The default isFalse.
- math_eqref_format¶
A string used for formatting the labels of references to equations. The
{number}place-holder stands for the equation number.Example:
'Eq.{number}'gets rendered as, for example,Eq.10.
- math_numfig¶
If
True, displayed math equations are numbered across pages whennumfigis enabled. Thenumfig_secnum_depthsetting is respected. Theeq, notnumref, role must be used to reference equation numbers. Default isTrue.New in version 1.7.
Options for HTML output¶
These options influence HTML as well as HTML Help output, and other builders that use Sphinx’s HTMLWriter class.
- html_theme¶
The “theme” that the HTML output should use. See the section about theming. The default is
'alabaster'.New in version 0.6.
- html_theme_options¶
A dictionary of options that influence the look and feel of the selected theme. These are theme-specific. For the options understood by the builtin themes, see this section.
New in version 0.6.
- html_theme_path¶
A list of paths that contain custom themes, either as subdirectories or as zip files. Relative paths are taken as relative to the configuration directory.
New in version 0.6.
- html_style¶
The style sheet to use for HTML pages. A file of that name must exist either in Sphinx’s
static/path, or in one of the custom paths given inhtml_static_path. Default is the stylesheet given by the selected theme. If you only want to add or override a few things compared to the theme’s stylesheet, use CSS@importto import the theme’s stylesheet.
- html_title¶
The “title” for HTML documentation generated with Sphinx’s own templates. This is appended to the
<title>tag of individual pages, and used in the navigation bar as the “topmost” element. It defaults to'<project> v<revision> documentation'.
- html_short_title¶
A shorter “title” for the HTML docs. This is used for links in the header and in the HTML Help docs. If not given, it defaults to the value of
html_title.New in version 0.4.
- html_baseurl¶
The base URL which points to the root of the HTML documentation. It is used to indicate the location of document using The Canonical Link Relation. Default:
''.New in version 1.8.
- html_codeblock_linenos_style¶
The style of line numbers for code-blocks.
'table'– display line numbers using<table>tag'inline'– display line numbers using<span>tag (default)
New in version 3.2.
Changed in version 4.0: It defaults to
'inline'.Deprecated since version 4.0.
- html_context¶
A dictionary of values to pass into the template engine’s context for all pages. Single values can also be put in this dictionary using the
-Acommand-line option ofsphinx-build.New in version 0.5.
- html_logo¶
If given, this must be the name of an image file (path relative to the configuration directory) that is the logo of the docs, or URL that points an image file for the logo. It is placed at the top of the sidebar; its width should therefore not exceed 200 pixels. Default:
None.New in version 0.4.1: The image file will be copied to the
_staticdirectory of the output HTML, but only if the file does not already exist there.Changed in version 4.0: Also accepts the URL for the logo file.
- html_favicon¶
If given, this must be the name of an image file (path relative to the configuration directory) that is the favicon of the docs, or URL that points an image file for the favicon. Modern browsers use this as the icon for tabs, windows and bookmarks. It should be a Windows-style icon file (
.ico), which is 16x16 or 32x32 pixels large. Default:None.New in version 0.4: The image file will be copied to the
_staticdirectory of the output HTML, but only if the file does not already exist there.Changed in version 4.0: Also accepts the URL for the favicon.
- html_css_files¶
A list of CSS files. The entry must be a filename string or a tuple containing the filename string and the attributes dictionary. The filename must be relative to the
html_static_path, or a full URI with scheme likehttps://example.org/style.css. The attributes is used for attributes of<link>tag. It defaults to an empty list.Example:
html_css_files = ['custom.css', 'https://example.com/css/custom.css', ('print.css', {'media': 'print'})]
As a special attribute, priority can be set as an integer to load the CSS file earlier or lazier step. For more information, refer
Sphinx.add_css_files().New in version 1.8.
Changed in version 3.5: Support priority attribute
- html_js_files¶
A list of JavaScript filename. The entry must be a filename string or a tuple containing the filename string and the attributes dictionary. The filename must be relative to the
html_static_path, or a full URI with scheme likehttps://example.org/script.js. The attributes is used for attributes of<script>tag. It defaults to an empty list.Example:
html_js_files = ['script.js', 'https://example.com/scripts/custom.js', ('custom.js', {'async': 'async'})]
As a special attribute, priority can be set as an integer to load the CSS file earlier or lazier step. For more information, refer
Sphinx.add_css_files().New in version 1.8.
Changed in version 3.5: Support priority attribute
- html_static_path¶
A list of paths that contain custom static files (such as style sheets or script files). Relative paths are taken as relative to the configuration directory. They are copied to the output’s
_staticdirectory after the theme’s static files, so a file nameddefault.csswill overwrite the theme’sdefault.css.As these files are not meant to be built, they are automatically excluded from source files.
Note
For security reasons, dotfiles under
html_static_pathwill not be copied. If you would like to copy them intentionally, please add each filepath to this setting:html_static_path = ['_static', '_static/.htaccess']
Another way to do that, you can also use
html_extra_path. It allows to copy dotfiles under the directories.Changed in version 0.4: The paths in
html_static_pathcan now contain subdirectories.Changed in version 1.0: The entries in
html_static_pathcan now be single files.Changed in version 1.8: The files under
html_static_pathare excluded from source files.- html_extra_path¶
A list of paths that contain extra files not directly related to the documentation, such as
robots.txtor.htaccess. Relative paths are taken as relative to the configuration directory. They are copied to the output directory. They will overwrite any existing file of the same name.As these files are not meant to be built, they are automatically excluded from source files.
New in version 1.2.
Changed in version 1.4: The dotfiles in the extra directory will be copied to the output directory. And it refers
exclude_patternson copying extra files and directories, and ignores if path matches to patterns.
- html_last_updated_fmt¶
If this is not None, a ‘Last updated on:’ timestamp is inserted at every page bottom, using the given
strftime()format. The empty string is equivalent to'%b %d, %Y'(or a locale-dependent equivalent).
- html_use_smartypants¶
If true, quotes and dashes are converted to typographically correct entities. Default:
True.Deprecated since version 1.6: To disable smart quotes, use rather
smartquotes.
- html_add_permalinks¶
Sphinx will add “permalinks” for each heading and description environment as paragraph signs that become visible when the mouse hovers over them.
This value determines the text for the permalink; it defaults to
"¶". Set it toNoneor the empty string to disable permalinks.New in version 0.6: Previously, this was always activated.
Changed in version 1.1: This can now be a string to select the actual text of the link. Previously, only boolean values were accepted.
Deprecated since version 3.5: This has been replaced by
html_permalinks
- html_permalinks¶
If true, Sphinx will add “permalinks” for each heading and description environment. Default:
True.New in version 3.5.
- html_permalinks_icon¶
A text for permalinks for each heading and description environment. HTML tags are allowed. Default: a paragraph sign;
¶New in version 3.5.
- html_sidebars¶
Custom sidebar templates, must be a dictionary that maps document names to template names.
The keys can contain glob-style patterns [1], in which case all matching documents will get the specified sidebars. (A warning is emitted when a more than one glob-style pattern matches for any document.)
The values can be either lists or single strings.
If a value is a list, it specifies the complete list of sidebar templates to include. If all or some of the default sidebars are to be included, they must be put into this list as well.
The default sidebars (for documents that don’t match any pattern) are defined by theme itself. Builtin themes are using these templates by default:
['localtoc.html', 'relations.html', 'sourcelink.html', 'searchbox.html'].If a value is a single string, it specifies a custom sidebar to be added between the
'sourcelink.html'and'searchbox.html'entries. This is for compatibility with Sphinx versions before 1.0.
Deprecated since version 1.7: a single string value for
html_sidebarswill be removed in 2.0Builtin sidebar templates that can be rendered are:
localtoc.html – a fine-grained table of contents of the current document
globaltoc.html – a coarse-grained table of contents for the whole documentation set, collapsed
relations.html – two links to the previous and next documents
sourcelink.html – a link to the source of the current document, if enabled in
html_show_sourcelinksearchbox.html – the “quick search” box
Example:
html_sidebars = { '**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'], 'using/windows': ['windowssidebar.html', 'searchbox.html'], }
This will render the custom template
windowssidebar.htmland the quick search box within the sidebar of the given document, and render the default sidebars for all other pages (except that the local TOC is replaced by the global TOC).New in version 1.0: The ability to use globbing keys and to specify multiple sidebars.
Note that this value only has no effect if the chosen theme does not possess a sidebar, like the builtin scrolls and haiku themes.
- html_additional_pages¶
Additional templates that should be rendered to HTML pages, must be a dictionary that maps document names to template names.
Example:
html_additional_pages = { 'download': 'customdownload.html', }
This will render the template
customdownload.htmlas the pagedownload.html.
- html_domain_indices¶
If true, generate domain-specific indices in addition to the general index. For e.g. the Python domain, this is the global module index. Default is
True.This value can be a bool or a list of index names that should be generated. To find out the index name for a specific index, look at the HTML file name. For example, the Python module index has the name
'py-modindex'.New in version 1.0.
- html_use_index¶
If true, add an index to the HTML documents. Default is
True.New in version 0.4.
- html_split_index¶
If true, the index is generated twice: once as a single page with all the entries, and once as one page per starting letter. Default is
False.New in version 0.4.
- html_copy_source¶
If true, the reST sources are included in the HTML build as
_sources/name. The default isTrue.
- html_show_sourcelink¶
If true (and
html_copy_sourceis true as well), links to the reST sources will be added to the sidebar. The default isTrue.New in version 0.6.
- html_sourcelink_suffix¶
Suffix to be appended to source links (see
html_show_sourcelink), unless they have this suffix already. Default is'.txt'.New in version 1.5.
- html_use_opensearch¶
If nonempty, an OpenSearch description file will be output, and all pages will contain a
<link>tag referring to it. Since OpenSearch doesn’t support relative URLs for its search page location, the value of this option must be the base URL from which these documents are served (without trailing slash), e.g."https://docs.python.org". The default is''.
- html_file_suffix¶
This is the file name suffix for generated HTML files. The default is
".html".New in version 0.4.
- html_link_suffix¶
Suffix for generated links to HTML files. The default is whatever
html_file_suffixis set to; it can be set differently (e.g. to support different web server setups).New in version 0.6.
- html_show_copyright¶
If true, “(C) Copyright …” is shown in the HTML footer. Default is
True.New in version 1.0.
- html_show_sphinx¶
If true, “Created using Sphinx” is shown in the HTML footer. Default is
True.New in version 0.4.
- html_output_encoding¶
Encoding of HTML output files. Default is
'utf-8'. Note that this encoding name must both be a valid Python encoding name and a valid HTMLcharsetvalue.New in version 1.0.
- html_compact_lists¶
If true, a list all whose items consist of a single paragraph and/or a sub-list all whose items etc… (recursive definition) will not use the
<p>element for any of its items. This is standard docutils behavior. Default:True.New in version 1.0.
- html_secnumber_suffix¶
Suffix for section numbers. Default:
". ". Set to" "to suppress the final dot on section numbers.New in version 1.0.
- html_search_language¶
Language to be used for generating the HTML full-text search index. This defaults to the global language selected with
language. If there is no support for this language,"en"is used which selects the English language.Support is present for these languages:
da– Danishnl– Dutchen– Englishfi– Finnishfr– Frenchde– Germanhu– Hungarianit– Italianja– Japaneseno– Norwegianpt– Portuguesero– Romanianru– Russianes– Spanishsv– Swedishtr– Turkishzh– Chinese