Debian Codegraph @

doc/usage/configuration.rst

raw
1 .. _build-config:
2
3 =============
4 Configuration
5 =============
6
7 .. module:: conf
8 :synopsis: Build configuration file.
9
10 .. role:: code-c(code)
11 :language: C
12 .. role:: code-cpp(code)
13 :language: C++
14 .. role:: code-js(code)
15 :language: JavaScript
16 .. role:: code-py(code)
17 :language: Python
18 .. role:: code-rst(code)
19 :language: reStructuredText
20 .. role:: code-tex(code)
21 :language: LaTeX
22
23 The :term:`configuration directory` must contain a file named :file:`conf.py`.
24 This file (containing Python code) is called the "build configuration file"
25 and contains (almost) all configuration needed to customise Sphinx input
26 and output behaviour.
27
28 An optional file `docutils.conf`_ can be added to the configuration
29 directory to adjust `Docutils`_ configuration if not otherwise overridden or
30 set by Sphinx.
31
32 .. _`docutils`: https://docutils.sourceforge.io/
33 .. _`docutils.conf`: https://docutils.sourceforge.io/docs/user/config.html
34
35 Important points to note:
36
37 * If not otherwise documented, values must be strings,
38 and their default is the empty string.
39
40 * The term "fully-qualified name" (FQN) refers to a string that names an importable
41 Python object inside a module; for example, the fully-qualified name
42 :code-py:`"sphinx.builders.Builder"` means the :code-py:`Builder` class in the
43 :code-py:`sphinx.builders` module.
44
45 * Document names use ``/`` as the path separator
46 and do not contain the file name extension.
47
48 .. _glob-style patterns:
49
50 * Where glob-style patterns are permitted,
51 you can use the standard shell constructs
52 (``*``, ``?``, ``[...]``, and ``[!...]``)
53 with the feature that none of these will match slashes (``/``).
54 A double star ``**`` can be used to match any sequence of characters
55 *including* slashes.
56
57 .. tip::
58
59 The configuration file is executed as Python code at build time
60 (using :func:`importlib.import_module`, with the current directory set
61 to the :term:`configuration directory`),
62 and therefore can execute arbitrarily complex code.
63
64 Sphinx then reads simple names from the file's namespace as its configuration.
65 In general, configuration values should be simple strings, numbers, or
66 lists or dictionaries of simple values.
67
68 The contents of the config namespace are pickled (so that Sphinx can find out
69 when configuration changes), so it may not contain unpickleable values --
70 delete them from the namespace with ``del`` if appropriate.
71 Modules are removed automatically, so deleting imported modules is not needed.
72
73
74 .. _conf-tags:
75
76 Project tags
77 ============
78
79 There is a special object named ``tags`` available in the config file,
80 which exposes the :ref:`project tags <tags>`.
81 Tags are defined either via the
82 :option:`--tag <sphinx-build --tag>` command-line option
83 or :code-py:`tags.add('tag')`.
84 Note that the builder's name and format tags are not available in :file:`conf.py`.
85
86 It can be used to query and change the defined tags as follows:
87
88 * To query whether a tag is set, use :code-py:`'tag' in tags`.
89 * To add a tag, use :code-py:`tags.add('tag')`.
90 * To remove a tag, use :code-py:`tags.remove('tag')`.
91
92 Project information
93 ===================
94
95 .. confval:: project
96 :type: :code-py:`str`
97 :default: :code-py:`'Project name not set'`
98
99 The documented project's name.
100 Example:
101
102 .. code-block:: python
103
104 project = 'Thermidor'
105
106 .. confval:: author
107 :type: :code-py:`str`
108 :default: :code-py:`'Author name not set'`
109
110 The project's author(s).
111 Example:
112
113 .. code-block:: python
114
115 author = 'Joe Bloggs'
116
117 .. _config-copyright:
118
119 .. confval:: copyright
120 project_copyright
121 :type: :code-py:`str | Sequence[str]`
122 :default: :code-py:`''`
123
124 A copyright statement.
125 Permitted styles are as follows, where 'YYYY' represents a four-digit year.
126
127 * :code-py:`copyright = 'YYYY'`
128 * :code-py:`copyright = 'YYYY, Author Name'`
129 * :code-py:`copyright = 'YYYY Author Name'`
130 * :code-py:`copyright = 'YYYY-YYYY, Author Name'`
131 * :code-py:`copyright = 'YYYY-YYYY Author Name'`
132
133 If the string :code-py:`'%Y'` appears in a copyright line,
134 it will be replaced with the current four-digit year.
135 For example:
136
137 * :code-py:`copyright = '%Y'`
138 * :code-py:`copyright = '%Y, Author Name'`
139 * :code-py:`copyright = 'YYYY-%Y, Author Name'`
140
141 .. versionadded:: 3.5
142 The :code-py:`project_copyright` alias.
143
144 .. versionchanged:: 7.1
145 The value may now be a sequence of copyright statements in the above form,
146 which will be displayed each to their own line.
147
148 .. versionchanged:: 8.1
149 Copyright statements support the :code-py:`'%Y'` placeholder.
150
151 .. confval:: version
152 :type: :code-py:`str`
153 :default: :code-py:`''`
154
155 The major project version, used as the replacement for the :code-rst:`|version|`
156 :ref:`default substitution <default-substitutions>`.
157
158 This may be something like :code-py:`version = '4.2'`.
159 The full project version is defined in :confval:`release`.
160
161 If your project does not draw a meaningful distinction between
162 between a 'full' and 'major' version,
163 set both :code-py:`version` and :code-py:`release` to the same value.
164
165 .. confval:: release
166 :type: :code-py:`str`
167 :default: :code-py:`''`
168
169 The full project version, used as the replacement for the :code-rst:`|release|`
170 :ref:`default substitution <default-substitutions>`, and
171 e.g. in the HTML templates.
172
173 This may be something like :code-py:`release = '4.2.1b0'`.
174 The major (short) project version is defined in :confval:`version`.
175
176 If your project does not draw a meaningful distinction between
177 between a 'full' and 'major' version,
178 set both :code-py:`version` and :code-py:`release` to the same value.
179
180
181 General configuration
182 =====================
183
184 .. confval:: needs_sphinx
185 :type: :code-py:`str`
186 :default: :code-py:`''`
187
188 Set a minimum supported version of Sphinx required to build the project.
189 The format should be a ``'major.minor'`` version string like ``'1.1'``
190 Sphinx will compare it with its version and refuse to build the project
191 if the running version of Sphinx is too old.
192 By default, there is no minimum version.
193
194 .. versionadded:: 1.0
195
196 .. versionchanged:: 1.4
197 Allow a ``'major.minor.micro'`` version string.
198
199 .. confval:: extensions
200 :type: :code-py:`list[str]`
201 :default: :code-py:`[]`
202
203 A list of strings that are module names of
204 :doc:`Sphinx extensions <extensions/index>`.
205 These can be extensions bundled with Sphinx (named ``sphinx.ext.*``)
206 or custom first-party or third-party extensions.
207
208 To use a third-party extension, you must ensure that it is installed
209 and include it in the :code-py:`extensions` list, like so:
210
211 .. code-block:: python
212
213 extensions = [
214 ...
215 'numpydoc',
216 ]
217
218 There are two options for first-party extensions.
219 The configuration file itself can be an extension;
220 for that, you only need to provide a :func:`setup` function in it.
221 Otherwise, you must ensure that your custom extension is importable,
222 and located in a directory that is in the Python path.
223
224 Ensure that absolute paths are used when modifying :data:`sys.path`.
225 If your custom extensions live in a directory that is relative to the
226 :term:`configuration directory`, use :meth:`pathlib.Path.resolve` like so:
227
228 .. code-block:: python
229
230 import sys
231 from pathlib import Path
232
233 sys.path.append(str(Path('sphinxext').resolve()))
234
235 extensions = [
236 ...
237 'extname',
238 ]
239
240 The directory structure illustrated above would look like this:
241
242 .. code-block:: none
243
244 <project directory>/
245 ├── conf.py
246 └── sphinxext/
247    └── extname.py
248
249
250 .. confval:: needs_extensions
251 :type: :code-py:`dict[str, str]`
252 :default: :code-py:`{}`
253
254 If set, this value must be a dictionary specifying version requirements
255 for extensions in :confval:`extensions`.
256 The version strings should be in the ``'major.minor'`` form.
257 Requirements do not have to be specified for all extensions,
258 only for those you want to check.
259 Example:
260
261 .. code-block:: python
262
263 needs_extensions = {
264 'sphinxcontrib.something': '1.5',
265 }
266
267 This requires that the extension declares its version
268 in the :code-py:`setup()` function. See :ref:`dev-extensions` for further details.
269
270 .. versionadded:: 1.3
271
272 .. confval:: manpages_url
273 :type: :code-py:`str`
274 :default: :code-py:`''`
275
276 A URL to cross-reference :rst:role:`manpage` roles.
277 If this is defined to ``https://manpages.debian.org/{path}``,
278 the :literal:`:manpage:`man(1)`` role will link to
279 <https://manpages.debian.org/man(1)>.
280 The patterns available are:
281
282 ``page``
283 The manual page (``man``)
284 ``section``
285 The manual section (``1``)
286 ``path``
287 The original manual page and section specified (``man(1)``)
288
289 This also supports manpages specified as ``man.1``.
290
291 .. code-block:: python
292
293 # To use manpages.debian.org:
294 manpages_url = 'https://manpages.debian.org/{path}'
295 # To use man7.org:
296 manpages_url = 'https://man7.org/linux/man-pages/man{section}/{page}.{section}.html'
297 # To use linux.die.net:
298 manpages_url = 'https://linux.die.net/man/{section}/{page}'
299 # To use helpmanual.io:
300 manpages_url = 'https://helpmanual.io/man{section}/{page}'
301
302 .. versionadded:: 1.7
303
304 .. confval:: today
305 today_fmt
306
307 These values determine how to format the current date,
308 used as the replacement for the :code-rst:`|today|`
309 :ref:`default substitution <default-substitutions>`.
310
311 * If you set :confval:`today` to a non-empty value, it is used.
312 * Otherwise, the current time is formatted using :func:`time.strftime` and
313 the format given in :confval:`today_fmt`.
314
315 The default for :confval:`today` is :code-py:`''`,
316 and the default for :confval:`today_fmt` is :code-py:`'%b %d, %Y'`
317 (or, if translation is enabled with :confval:`language`,
318 an equivalent format for the selected locale).
319
320
321 Options for figure numbering
322 ----------------------------
323
324 .. confval:: numfig
325 :type: :code-py:`bool`
326 :default: :code-py:`False`
327
328 If :code-py:`True`, figures, tables and code-blocks are automatically numbered
329 if they have a caption.
330 The :rst:role:`numref` role is enabled.
331 Obeyed so far only by HTML and LaTeX builders.
332
333 .. note::
334
335 The LaTeX builder always assigns numbers whether this option is enabled
336 or not.
337
338 .. versionadded:: 1.3
339
340 .. confval:: numfig_format
341 :type: :code-py:`dict[str, str]`
342 :default: :code-py:`{}`
343
344 A dictionary mapping :code-py:`'figure'`, :code-py:`'table'`,
345 :code-py:`'code-block'` and :code-py:`'section'` to strings
346 that are used for format of figure numbers.
347 The marker ``%s`` will be replaced with the figure number.
348
349 The defaults are:
350
351 .. code-block:: python
352
353 numfig_format = {
354 'code-block': 'Listing %s',
355 'figure': 'Fig. %s',
356 'section': 'Section',
357 'table': 'Table %s',
358 }
359
360 .. versionadded:: 1.3
361
362 .. confval:: numfig_secnum_depth
363 :type: :code-py:`int`
364 :default: :code-py:`1`
365
366 * If set to :code-py:`0`, figures, tables, and code-blocks
367 are continuously numbered starting at ``1``.
368 * If :code-py:`1`, the numbering will be ``x.1``, ``x.2``, ...
369 with ``x`` representing the section number.
370 (If there is no top-level section, the prefix will not be added ).
371 This naturally applies only if section numbering has been activated via
372 the ``:numbered:`` option of the :rst:dir:`toctree` directive.
373 * If :code-py:`2`, the numbering will be ``x.y.1``, ``x.y.2``, ...
374 with ``x`` representing the section number and ``y`` the sub-section number.
375 If located directly under a section, there will be no ``y.`` prefix,
376 and if there is no top-level section, the prefix will not be added.
377 * Any other positive integer can be used, following the rules above.
378
379 .. versionadded:: 1.3
380
381 .. versionchanged:: 1.7
382 The LaTeX builder obeys this setting
383 if :confval:`numfig` is set to :code-py:`True`.
384
385
386 Options for highlighting
387 ------------------------
388
389 .. confval:: highlight_language
390 :type: :code-py:`str`
391 :default: :code-py:`'default'`
392
393 The default language to highlight source code in.
394 The default is :code-py:`'default'`,
395 which suppresses warnings if highlighting as Python code fails.
396
397 The value should be a valid Pygments lexer name, see
398 :ref:`code-examples` for more details.
399
400 .. versionadded:: 0.5
401
402 .. versionchanged:: 1.4
403 The default is now :code-py:`'default'`.
404
405 .. confval:: highlight_options
406 :type: :code-py:`dict[str, dict[str, Any]]`
407 :default: :code-py:`{}`
408
409 A dictionary that maps Pygments lexer names to their options.
410 These are lexer-specific; for the options understood by each,
411 see the `Pygments documentation <https://pygments.org/docs/lexers>`_.
412
413 Example:
414
415 .. code-block:: python
416
417 highlight_options = {
418 'default': {'stripall': True},
419 'php': {'startinline': True},
420 }
421
422 .. versionadded:: 1.3
423 .. versionchanged:: 3.5
424
425 Allow configuring highlight options for multiple lexers.
426
427 .. confval:: pygments_style
428 :type: :code-py:`str`
429 :default: :code-py:`'sphinx'`
430
431 The style name to use for Pygments highlighting of source code.
432 If not set, either the theme's default style
433 or :code-py:`'sphinx'` is selected for HTML output.
434
435 .. versionchanged:: 0.3
436 If the value is a fully-qualified name of a custom Pygments style class,
437 this is then used as custom style.
438
439
440 Options for HTTP requests
441 -------------------------
442
443 .. confval:: tls_verify
444 :type: :code-py:`bool`
445 :default: :code-py:`True`
446
447 If True, Sphinx verifies server certificates.
448
449 .. versionadded:: 1.5
450
451 .. confval:: tls_cacerts
452 :type: :code-py:`str | dict[str, str]`
453 :default: :code-py:`''`
454
455 A path to a certification file of CA or
456 a path to directory which contains the certificates.
457 This also allows a dictionary mapping
458 hostnames to the certificate file path.
459 The certificates are used to verify server certifications.
460
461 .. versionadded:: 1.5
462
463 .. tip::
464
465 Sphinx uses requests_ as a HTTP library internally.
466 If :confval:`!tls_cacerts` is not set,
467 Sphinx falls back to requests' default behaviour.
468 See :ref:`requests:verification` for further details.
469
470 .. _requests: https://requests.readthedocs.io/
471
472 .. confval:: user_agent
473 :type: :code-py:`str`
474 :default: :code-py:`'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 \
475 Firefox/100.0 Sphinx/X.Y.Z'`
476
477 Set the User-Agent used by Sphinx for HTTP requests.
478
479 .. versionadded:: 2.3
480
481
482 .. _intl-options:
483
484 Options for internationalisation
485 --------------------------------
486
487 These options influence Sphinx's *Native Language Support*.
488 See the documentation on :ref:`intl` for details.
489
490 .. confval:: language
491 :type: :code-py:`str`
492 :default: :code-py:`'en'`
493
494 The code for the language the documents are written in.
495 Any text automatically generated by Sphinx will be in that language.
496 Also, Sphinx will try to substitute individual paragraphs
497 from your documents with the translation sets obtained
498 from :confval:`locale_dirs`.
499 Sphinx will search language-specific figures named by
500 :confval:`figure_language_filename`
501 (e.g. the German version of ``myfigure.png`` will be ``myfigure.de.png``
502 by default setting)
503 and substitute them for original figures.
504 In the LaTeX builder, a suitable language will be selected
505 as an option for the *Babel* package.
506
507 .. versionadded:: 0.5
508
509 .. versionchanged:: 1.4
510 Support figure substitution
511
512 .. versionchanged:: 5.0
513 The default is now :code-py:`'en'` (previously :code-py:`None`).
514
515 Currently supported languages by Sphinx are:
516
517 * ``ar`` -- Arabic
518 * ``bg`` -- Bulgarian
519 * ``bn`` -- Bengali
520 * ``ca`` -- Catalan
521 * ``cak`` -- Kaqchikel
522 * ``cs`` -- Czech
523 * ``cy`` -- Welsh
524 * ``da`` -- Danish
525 * ``de`` -- German
526 * ``el`` -- Greek
527 * ``en`` -- English (default)
528 * ``eo`` -- Esperanto
529 * ``es`` -- Spanish
530 * ``et`` -- Estonian
531 * ``eu`` -- Basque
532 * ``fa`` -- Iranian
533 * ``fi`` -- Finnish
534 * ``fr`` -- French
535 * ``he`` -- Hebrew
536 * ``hi`` -- Hindi
537 * ``hi_IN`` -- Hindi (India)
538 * ``hr`` -- Croatian
539 * ``hu`` -- Hungarian
540 * ``id`` -- Indonesian
541 * ``it`` -- Italian
542 * ``ja`` -- Japanese
543 * ``ko`` -- Korean
544 * ``lt`` -- Lithuanian
545 * ``lv`` -- Latvian
546 * ``mk`` -- Macedonian
547 * ``nb_NO`` -- Norwegian Bokmal
548 * ``ne`` -- Nepali
549 * ``nl`` -- Dutch
550 * ``pl`` -- Polish
551 * ``pt`` -- Portuguese
552 * ``pt_BR`` -- Brazilian Portuguese
553 * ``pt_PT`` -- European Portuguese
554 * ``ro`` -- Romanian
555 * ``ru`` -- Russian
556 * ``si`` -- Sinhala
557 * ``sk`` -- Slovak
558 * ``sl`` -- Slovenian
559 * ``sq`` -- Albanian
560 * ``sr`` -- Serbian
561 * ``sr@latin`` -- Serbian (Latin)
562 * ``sr_RS`` -- Serbian (Cyrillic)
563 * ``sv`` -- Swedish
564 * ``ta`` -- Tamil
565 * ``te`` -- Telugu
566 * ``tr`` -- Turkish
567 * ``uk_UA`` -- Ukrainian
568 * ``ur`` -- Urdu
569 * ``vi`` -- Vietnamese
570 * ``zh_CN`` -- Simplified Chinese
571 * ``zh_TW`` -- Traditional Chinese
572
573 .. confval:: locale_dirs
574 :type: :code-py:`list[str]`
575 :default: :code-py:`['locales']`
576
577 Directories in which to search for additional message catalogs
578 (see :confval:`language`), relative to the source directory.
579 The directories on this path are searched by the :mod:`gettext` module.
580
581 Internal messages are fetched from a text domain of ``sphinx``;
582 so if you add the directory :file:`./locales` to this setting,
583 the message catalogs
584 (compiled from ``.po`` format using :program:`msgfmt`)
585 must be in :file:`./locales/{language}/LC_MESSAGES/sphinx.mo`.
586 The text domain of individual documents
587 depends on :confval:`gettext_compact`.
588
589 .. note::
590 The :option:`-v option to sphinx-build <sphinx-build -v>`
591 is useful to check the :confval:`!locale_dirs` setting is working as expected.
592 If the message catalog directory not found, debug messages are emitted.
593
594 .. versionadded:: 0.5
595
596 .. versionchanged:: 1.5
597 Use ``locales`` directory as a default value
598
599 .. confval:: gettext_allow_fuzzy_translations
600 :type: :code-py:`bool`
601 :default: :code-py:`False`
602
603 If True, "fuzzy" messages in the message catalogs are used for translation.
604
605 .. versionadded:: 4.3
606
607 .. confval:: gettext_compact
608 :type: :code-py:`bool | str`
609 :default: :code-py:`True`
610
611 * If :code-py:`True`, a document's text domain is
612 its docname if it is a top-level project file
613 and its very base directory otherwise.
614 * If :code-py:`False`, a document's text domain is
615 the docname, in full.
616 * If set to a string, every document's text domain is
617 set to this string, making all documents use single text domain.
618
619 With :code-py:`gettext_compact = True`, the document
620 :file:`markup/code.rst` ends up in the ``markup`` text domain.
621 With this option set to :code-py:`False`, it is ``markup/code``.
622 With this option set to :code-py:`'sample'`, it is ``sample``.
623
624 .. versionadded:: 1.1
625
626 .. versionchanged:: 3.3
627 Allow string values.
628
629 .. confval:: gettext_uuid
630 :type: :code-py:`bool`
631 :default: :code-py:`False`
632
633 If :code-py:`True`, Sphinx generates UUID information
634 for version tracking in message catalogs.
635 It is used to:
636
637 * Add a UUID line for each *msgid* in ``.pot`` files.
638 * Calculate similarity between new msgids and previously saved old msgids.
639 (This calculation can take a long time.)
640
641 .. tip::
642 If you want to accelerate the calculation,
643 you can use a third-party package (Levenshtein_) by running
644 :command:`pip install levenshtein`.
645
646 .. _Levenshtein: https://pypi.org/project/Levenshtein/
647
648 .. versionadded:: 1.3
649
650 .. confval:: gettext_location
651 :type: :code-py:`bool`
652 :default: :code-py:`True`
653
654 If :code-py:`True`, Sphinx generates location information
655 for messages in message catalogs.
656
657 .. versionadded:: 1.3
658
659 .. confval:: gettext_auto_build
660 :type: :code-py:`bool`
661 :default: :code-py:`True`
662
663 If :code-py:`True`, Sphinx builds a ``.mo`` file
664 for each translation catalog file.
665
666 .. versionadded:: 1.3
667
668 .. confval:: gettext_additional_targets
669 :type: :code-py:`set[str] | Sequence[str]`
670 :default: :code-py:`[]`
671
672 Enable ``gettext`` translation for certain element types.
673 Example:
674
675 .. code-block:: python
676
677 gettext_additional_targets = {'literal-block', 'image'}
678
679 The following element types are supported:
680
681 * :code-py:`'index'` -- index terms
682 * :code-py:`'literal-block'` -- literal blocks
683 (``::`` annotation and ``code-block`` directive)
684 * :code-py:`'doctest-block'` -- doctest block
685 * :code-py:`'raw'` -- raw content
686 * :code-py:`'image'` -- image/figure uri
687
688 .. versionadded:: 1.3
689 .. versionchanged:: 4.0
690 The alt text for images is translated by default.
691 .. versionchanged:: 7.4
692 Permit and prefer a set type.
693
694 .. confval:: figure_language_filename
695 :type: :code-py:`str`
696 :default: :code-py:`'{root}.{language}{ext}'`
697
698 The filename format for language-specific figures.
699 The available format tokens are:
700
701 * ``{root}``: the filename, including any path component,
702 without the file extension.
703 For example: ``images/filename``.
704 * ``{path}``: the directory path component of the filename,
705 with a trailing slash if non-empty.
706 For example: ``images/``.
707 * ``{basename}``: the filename without the directory path
708 or file extension components.
709 For example: ``filename``.
710 * ``{ext}``: the file extension.
711 For example: ``.png``.
712 * ``{language}``: the translation language.
713 For example: ``en``.
714 * ``{docpath}``: the directory path component for the current document,
715 with a trailing slash if non-empty.
716 For example: ``dirname/``.
717
718 By default, an image directive :code-rst:`.. image:: images/filename.png`,
719 using an image at :file:`images/filename.png`,
720 will use the language-specific figure filename
721 :file:`images/filename.en.png`.
722
723 If :confval:`!figure_language_filename` is set as below,
724 the language-specific figure filename will be
725 :file:`images/en/filename.png` instead.
726
727 .. code-block:: python
728
729 figure_language_filename = '{path}{language}/{basename}{ext}'
730
731 .. versionadded:: 1.4
732
733 .. versionchanged:: 1.5
734 Added ``{path}`` and ``{basename}`` tokens.
735
736 .. versionchanged:: 3.2
737 Added ``{docpath}`` token.
738
739 .. confval:: translation_progress_classes
740 :type: :code-py:`bool | 'translated' | 'untranslated'`
741 :default: :code-py:`False`
742
743 Control which, if any, classes are added to indicate translation progress.
744 This setting would likely only be used by translators of documentation,
745 in order to quickly indicate translated and untranslated content.
746
747 :code-py:`True`
748 Add ``translated`` and ``untranslated`` classes
749 to all nodes with translatable content.
750 :code-py:`'translated'`
751 Only add the ``translated`` class.
752 :code-py:`'untranslated'`
753 Only add the ``untranslated`` class.
754 :code-py:`False`
755 Do not add any classes to indicate translation progress.
756
757 .. versionadded:: 7.1
758
759
760 Options for markup
761 ------------------
762
763 .. confval:: default_role
764 :type: :code-py:`str`
765 :default: :code-py:`None`
766
767 .. index:: default; role
768
769 The name of a reStructuredText role (builtin or Sphinx extension)
770 to use as the default role, that is, for text marked up ```like this```.
771 This can be set to :code-py:`'py:obj'` to make ```filter```
772 a cross-reference to the Python function "filter".
773
774 The default role can always be set within individual documents using
775 the standard reStructuredText :dudir:`default-role` directive.
776
777 .. versionadded:: 0.4
778
779 .. confval:: keep_warnings
780 :type: :code-py:`bool`
781 :default: :code-py:`False`
782
783 Keep warnings as "system message" paragraphs in the rendered documents.
784 Warnings are always written to the standard error stream
785 when :program:`sphinx-build` is run, regardless of this setting.
786
787 .. versionadded:: 0.5
788
789 .. confval:: option_emphasise_placeholders
790 :type: :code-py:`bool`
791 :default: :code-py:`False`
792
793 When enabled, emphasise placeholders in :rst:dir:`option` directives.
794 To display literal braces, escape with a backslash (``\{``).
795 For example, ``option_emphasise_placeholders=True``
796 and ``.. option:: -foption={TYPE}`` would render with ``TYPE`` emphasised.
797
798 .. versionadded:: 5.1
799
800 .. confval:: primary_domain
801 :type: :code-py:`str`
802 :default: :code-py:`'py'`
803
804 .. index:: pair: default; domain
805
806 The name of the default :doc:`domain </usage/domains/index>`.
807 Can also be :code-py:`None` to disable a default domain.
808 The default is :code-py:`'py'`, for the Python domain.
809
810 Those objects in other domain
811 (whether the domain name is given explicitly,
812 or selected by a :rst:dir:`default-domain` directive)
813 will have the domain name explicitly prepended when named
814 (e.g., when the default domain is C,
815 Python functions will be named "Python function", not just "function").
816 Example:
817
818 .. code-block:: python
819
820 primary_domain = 'cpp'
821
822 .. versionadded:: 1.0
823
824 .. confval:: rst_epilog
825 :type: :code-py:`str`
826 :default: :code-py:`''`
827
828 .. index:: pair: global; substitutions
829
830 A string of reStructuredText that will be included
831 at the end of every source file that is read.
832 This is a possible place to add substitutions that
833 should be available in every file (another being :confval:`rst_prolog`).
834 Example:
835
836 .. code-block:: python
837
838 rst_epilog = """
839 .. |psf| replace:: Python Software Foundation
840 """
841
842 .. versionadded:: 0.6
843
844 .. confval:: rst_prolog
845 :type: :code-py:`str`
846 :default: :code-py:`''`
847
848 .. index:: pair: global; substitutions
849
850 A string of reStructuredText that will be included
851 at the beginning of every source file that is read.
852 This is a possible place to add substitutions that
853 should be available in every file (another being :confval:`rst_epilog`).
854 Example:
855
856 .. code-block:: python
857
858 rst_prolog = """
859 .. |psf| replace:: Python Software Foundation
860 """
861
862 .. versionadded:: 1.0
863
864 .. confval:: show_authors
865 :type: :code-py:`bool`
866 :default: :code-py:`False`
867
868 A boolean that decides whether :rst:dir:`codeauthor` and
869 :rst:dir:`sectionauthor` directives produce any output in the built files.
870
871 .. confval:: trim_footnote_reference_space
872 :type: :code-py:`bool`
873 :default: :code-py:`False`
874
875 Trim spaces before footnote references that are
876 necessary for the reStructuredText parser to recognise the footnote,
877 but do not look too nice in the output.
878
879 .. versionadded:: 0.6
880
881
882 .. _math-options:
883
884 Options for Maths
885 -----------------
886
887 These options control maths markup and notation.
888
889 .. confval:: math_eqref_format
890 :type: :code-py:`str`
891 :default: :code-py:`'({number})'`
892
893 A string used for formatting the labels of references to equations.
894 The ``{number}`` place-holder stands for the equation number.
895
896 Example: ``'Eq.{number}'`` gets rendered as, for example, ``Eq.10``.
897
898 .. versionadded:: 1.7
899
900 .. confval:: math_number_all
901 :type: :code-py:`bool`
902 :default: :code-py:`False`
903
904 Force all displayed equations to be numbered.
905 Example:
906
907 .. code-block:: python
908
909 math_number_all = True
910
911 .. versionadded:: 1.4
912
913 .. confval:: math_numfig
914 :type: :code-py:`bool`
915 :default: :code-py:`True`
916
917 If :code-py:`True`, displayed math equations are numbered across pages
918 when :confval:`numfig` is enabled.
919 The :confval:`numfig_secnum_depth` setting is respected.
920 The :rst:role:`eq`, not :rst:role:`numref`, role
921 must be used to reference equation numbers.
922
923 .. versionadded:: 1.7
924
925 .. confval:: math_numsep
926 :type: :code-py:`str`
927 :default: :code-py:`'.'`
928
929 A string that defines the separator between section numbers
930 and the equation number when :confval:`numfig` is enabled and
931 :confval:`numfig_secnum_depth` is positive.
932
933 Example: :code-py:`'-'` gets rendered as ``1.2-3``.
934
935 .. versionadded:: 7.4
936
937
938 Options for the nitpicky mode
939 -----------------------------
940
941 .. confval:: nitpicky
942 :type: :code-py:`bool`
943 :default: :code-py:`False`
944
945 Enables nitpicky mode if :code-py:`True`.
946 In nitpicky mode, Sphinx will warn about *all* references
947 where the target cannot be found.
948 This is recommended for new projects as it ensures that all references
949 are to valid targets.
950
951 You can activate this mode temporarily using
952 the :option:`--nitpicky <sphinx-build --nitpicky>` command-line option.
953 See :confval:`nitpick_ignore` for a way to mark missing references
954 as "known missing".
955
956 .. code-block:: python
957
958 nitpicky = True
959
960 .. versionadded:: 1.0
961
962 .. confval:: nitpick_ignore
963 :type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
964 :default: :code-py:`()`
965
966 A set or list of :code-py:`(warning_type, target)` tuples
967 that should be ignored when generating warnings
968 in :confval:`"nitpicky mode" <nitpicky>`.
969 Note that ``warning_type`` should include the domain name if present.
970 Example:
971
972 .. code-block:: python
973
974 nitpick_ignore = {
975 ('py:func', 'int'),
976 ('envvar', 'LD_LIBRARY_PATH'),
977 }
978
979 .. versionadded:: 1.1
980 .. versionchanged:: 6.2
981 Changed allowable container types to a set, list, or tuple
982
983 .. confval:: nitpick_ignore_regex
984 :type: :code-py:`set[tuple[str, str]] | Sequence[tuple[str, str]]`
985 :default: :code-py:`()`
986
987 An extended version of :confval:`nitpick_ignore`,
988 which instead interprets the ``warning_type`` and ``target`` strings
989 as regular expressions.
990 Note that the regular expression must match the whole string
991 (as if the ``^`` and ``$`` markers were inserted).
992
993 For example, ``(r'py:.*', r'foo.*bar\.B.*')`` will ignore nitpicky warnings
994 for all python entities that start with ``'foo'``
995 and have ``'bar.B'`` in them,
996 such as :code-py:`('py:const', 'foo_package.bar.BAZ_VALUE')`
997 or :code-py:`('py:class', 'food.bar.Barman')`.
998
999 .. versionadded:: 4.1
1000 .. versionchanged:: 6.2
1001 Changed allowable container types to a set, list, or tuple
1002
1003
1004 Options for object signatures
1005 -----------------------------
1006
1007 .. confval:: add_function_parentheses
1008 :type: :code-py:`bool`
1009 :default: :code-py:`True`
1010
1011 A boolean that decides whether parentheses are appended to function and
1012 method role text (e.g. the content of ``:func:`input```) to signify that the
1013 name is callable.
1014
1015 .. confval:: maximum_signature_line_length
1016 :type: :code-py:`int | None`
1017 :default: :code-py:`None`
1018
1019 If a signature's length in characters exceeds the number set,
1020 each parameter within the signature will be displayed on
1021 an individual logical line.
1022
1023 When :code-py:`None`, there is no maximum length and the entire
1024 signature will be displayed on a single logical line.
1025
1026 A 'logical line' is similar to a hard line break---builders or themes
1027 may choose to 'soft wrap' a single logical line,
1028 and this setting does not affect that behaviour.
1029
1030 Domains may provide options to suppress any hard wrapping
1031 on an individual object directive,
1032 such as seen in the C, C++, and Python domains
1033 (e.g. :rst:dir:`py:function:single-line-parameter-list`).
1034
1035 .. versionadded:: 7.1
1036
1037 .. confval:: strip_signature_backslash
1038 :type: :code-py:`bool`
1039 :default: :code-py:`False`
1040
1041 When backslash stripping is enabled then every occurrence of ``\\`` in a
1042 domain directive will be changed to ``\``, even within string literals.
1043 This was the behaviour before version 3.0, and setting this variable to
1044 :code-py:`True` will reinstate that behaviour.
1045
1046 .. versionadded:: 3.0
1047
1048 .. confval:: toc_object_entries
1049 :type: :code-py:`bool`
1050 :default: :code-py:`True`
1051
1052 Create table of contents entries for domain objects
1053 (e.g. functions, classes, attributes, etc.).
1054
1055 .. versionadded:: 5.2
1056
1057 .. confval:: toc_object_entries_show_parents
1058 :type: :code-py:`'domain' | 'hide' | 'all'`
1059 :default: :code-py:`'domain'`
1060
1061 A string that determines how domain objects
1062 (functions, classes, attributes, etc.)
1063 are displayed in their table of contents entry.
1064
1065 Use :code-py:`'domain'` to allow the domain to determine
1066 the appropriate number of parents to show.
1067 For example, the Python domain would show :code-py:`Class.method()`
1068 and :code-py:`function()`,
1069 leaving out the :code-py:`module.` level of parents.
1070
1071 Use :code-py:`'hide'` to only show the name of the element
1072 without any parents (i.e. :code-py:`method()`).
1073
1074 Use :code-py:`'all'` to show the fully-qualified name for the object
1075 (i.e. :code-py:`module.Class.method()`), displaying all parents.
1076
1077 .. versionadded:: 5.2
1078
1079
1080 Options for source files
1081 ------------------------
1082
1083 .. confval:: exclude_patterns
1084 :type: :code-py:`Sequence[str]`
1085 :default: :code-py:`()`
1086
1087 A list of `glob-style patterns`_ that should be excluded when looking for
1088 source files.
1089 They are matched against the source file names
1090 relative to the source directory,
1091 using slashes as directory separators on all platforms.
1092 :confval:`exclude_patterns` has priority over :confval:`include_patterns`.
1093
1094 Example patterns:
1095
1096 * :code-py:`'library/xml.rst'` -- ignores the ``library/xml.rst`` file
1097 * :code-py:`'library/xml'` -- ignores the ``library/xml`` directory
1098 * :code-py:`'library/xml*'` -- ignores all files and directories starting with
1099 :code-py:`library/xml`
1100 * :code-py:`'**/.git'` -- ignores all ``.git`` directories
1101 * :code-py:`'Thumbs.db'` -- ignores all ``Thumbs.db`` files
1102
1103 :confval:`exclude_patterns` is also consulted when looking for static files
1104 in :confval:`html_static_path` and :confval:`html_extra_path`.
1105
1106 .. versionadded:: 1.0
1107
1108 .. confval:: include_patterns
1109 :type: :code-py:`Sequence[str]`
1110 :default: :code-py:`('**',)`
1111
1112 A list of `glob-style patterns`_ that are used to find source files.
1113 They are matched against the source file
1114 names relative to the source directory,
1115 using slashes as directory separators on all platforms.
1116 By default, all files are recursively included from the source directory.
1117 :confval:`exclude_patterns` has priority over :confval:`include_patterns`.
1118
1119 Example patterns:
1120
1121 * :code-py:`'**'` -- all files in the source directory and subdirectories,
1122 recursively
1123 * :code-py:`'library/xml'` -- just the ``library/xml`` directory
1124 * :code-py:`'library/xml*'` -- all files and directories starting with
1125 ``library/xml``
1126 * :code-py:`'**/doc'` -- all ``doc`` directories (this might be useful if
1127 documentation is co-located with source files)
1128
1129 .. versionadded:: 5.1
1130
1131 .. confval:: master_doc
1132 root_doc
1133 :type: :code-py:`str`
1134 :default: :code-py:`'index'`
1135
1136 Sphinx builds a tree of documents based on the :rst:dir:`toctree` directives
1137 contained within the source files.
1138 This sets the name of the document containing the master ``toctree`` directive,
1139 and hence the root of the entire tree.
1140 Example:
1141
1142 .. code-block:: python
1143
1144 master_doc = 'contents'
1145
1146 .. versionchanged:: 2.0
1147 Default is :code-py:`'index'` (previously :code-py:`'contents'`).
1148
1149 .. versionadded:: 4.0
1150 The :confval:`!root_doc` alias.
1151
1152 .. confval:: source_encoding
1153 :type: :code-py:`str`
1154 :default: :code-py:`'utf-8-sig'`
1155
1156 The file encoding of all source files.
1157 The recommended encoding is ``'utf-8-sig'``.
1158
1159 .. versionadded:: 0.5
1160 .. deprecated:: 9.0
1161 Support for source encodings other than UTF-8 is deprecated.
1162 Sphinx 11 will only support UTF-8 files.
1163
1164 .. confval:: source_suffix
1165 :type: :code-py:`dict[str, str] | Sequence[str] | str`
1166 :default: :code-py:`{'.rst': 'restructuredtext'}`
1167
1168 A dictionary mapping the file extensions (suffixes)
1169 of source files to their file types.
1170 Sphinx considers all files files with suffixes in :code-py:`source_suffix`
1171 to be source files.
1172 Example:
1173
1174 .. code-block:: python
1175
1176 source_suffix = {
1177 '.rst': 'restructuredtext',
1178 '.txt': 'restructuredtext',
1179 '.md': 'markdown',
1180 }
1181
1182 By default, Sphinx only supports the :code-py:`'restructuredtext'` file type.
1183 Further file types can be added with extensions that register different
1184 source file parsers, such as `MyST-Parser`_.
1185 Refer to the extension's documentation to see which file types it supports.
1186
1187 .. _MyST-Parser: https://myst-parser.readthedocs.io/
1188
1189 If the value is a string or sequence of strings,
1190 Sphinx will consider that they are all :code-py:`'restructuredtext'` files.
1191
1192 .. note:: File extensions must begin with a dot (``'.'``).
1193
1194 .. versionchanged:: 1.3
1195 Support a list of file extensions.
1196
1197 .. versionchanged:: 1.8
1198 Change to a map of file extensions to file types.
1199
1200
1201 Options for smart quotes
1202 ------------------------
1203
1204 .. confval:: smartquotes
1205 :type: :code-py:`bool`
1206 :default: :code-py:`True`
1207
1208 If :code-py:`True`, the `Smart Quotes transform`__
1209 will be used to convert quotation marks and dashes
1210 to typographically correct entities.
1211
1212 __ https://docutils.sourceforge.io/docs/user/smartquotes.html
1213
1214 .. versionadded:: 1.6.6
1215 Replaces the now-removed :confval:`!html_use_smartypants`.
1216 It applies by default to all builders except ``man`` and ``text``
1217 (see :confval:`smartquotes_excludes`.)
1218
1219 .. note::
1220
1221 A `docutils.conf`__ file located in the :term:`configuration directory`
1222 (or a global :file:`~/.docutils` file) is obeyed unconditionally if it
1223 *deactivates* smart quotes via the corresponding `Docutils option`__.
1224 But if it *activates* them, then :confval:`smartquotes` does prevail.
1225
1226 __ https://docutils.sourceforge.io/docs/user/config.html
1227 __ https://docutils.sourceforge.io/docs/user/config.html#smart-quotes
1228
1229 .. confval:: smartquotes_action
1230 :type: :code-py:`str`
1231 :default: :code-py:`'qDe'`
1232
1233 Customise the Smart Quotes transform.
1234 See below for the permitted codes.
1235 The default :code-py:`'qDe'` educates
1236 normal **q**\ uote characters ``"``, ``'``,
1237 em- and en-**D**\ ashes ``---``, ``--``,
1238 and **e**\ llipses ``...``..
1239
1240 :code-py:`'q'`
1241 Convert quotation marks
1242 :code-py:`'b'`
1243 Convert backtick quotation marks
1244 (:literal:`\`\`double''` only)
1245 :code-py:`'B'`
1246 Convert backtick quotation marks
1247 (:literal:`\`\`double''` and :literal:`\`single'`)
1248 :code-py:`'d'`
1249 Convert dashes
1250 (convert ``--`` to em-dashes and ``---`` to en-dashes)
1251 :code-py:`'D'`
1252 Convert dashes (old school)
1253 (convert ``--`` to en-dashes and ``---`` to em-dashes)
1254 :code-py:`'i'`
1255 Convert dashes (inverted old school)
1256 (convert ``--`` to em-dashes and ``---`` to en-dashes)
1257 :code-py:`'e'`
1258 Convert ellipses ``...``
1259 :code-py:`'w'`
1260 Convert ``'&quot;'`` entities to ``'"'``
1261
1262 .. versionadded:: 1.6.6
1263
1264 .. confval:: smartquotes_excludes
1265 :type: :code-py:`dict[str, list[str]]`
1266 :default: :code-py:`{'languages': ['ja'], 'builders': ['man', 'text']}`
1267
1268 Control when the Smart Quotes transform is disabled.
1269 Permitted keys are :code-py:`'builders'` and :code-py:`'languages'`, and
1270 The values are lists of strings.
1271
1272 Each entry gives a sufficient condition to ignore the
1273 :confval:`smartquotes` setting and deactivate the Smart Quotes transform.
1274 Example:
1275
1276 .. code-block:: python
1277
1278 smartquotes_excludes = {
1279 'languages': ['ja'],
1280 'builders': ['man', 'text'],
1281 }
1282
1283 .. note::
1284
1285 Currently, in case of invocation of :program:`make` with multiple
1286 targets, the first target name is the only one which is tested against
1287 the :code-py:`'builders'` entry and it decides for all.
1288 Also, a ``make text`` following ``make html`` needs to be issued
1289 in the form ``make text SPHINXOPTS="-E"`` to force re-parsing
1290 of source files, as the cached ones are already transformed.
1291 On the other hand the issue does not arise with
1292 direct usage of :program:`sphinx-build` as it caches
1293 (in its default usage) the parsed source files in per builder locations.
1294
1295 .. hint::
1296
1297 An alternative way to effectively deactivate (or customise) the
1298 smart quotes for a given builder, for example ``latex``,
1299 is to use ``make`` this way:
1300
1301 .. code-block:: console
1302
1303 make latex SPHINXOPTS="-D smartquotes_action="
1304
1305 This can follow some ``make html`` with no problem, in contrast to the
1306 situation from the prior note.
1307
1308 .. versionadded:: 1.6.6
1309
1310
1311 Options for templating
1312 ----------------------
1313
1314 .. confval:: template_bridge
1315 :type: :code-py:`str`
1316 :default: :code-py:`''`
1317
1318 A string with the fully-qualified name of a callable (or simply a class)
1319 that returns an instance of :class:`~sphinx.application.TemplateBridge`.
1320 This instance is then used to render HTML documents,
1321 and possibly the output of other builders (currently the changes builder).
1322 (Note that the template bridge must be made theme-aware
1323 if HTML themes are to be used.)
1324 Example:
1325
1326 .. code-block:: python
1327
1328 template_bridge = 'module.CustomTemplateBridge'
1329
1330 .. confval:: templates_path
1331 :type: :code-py:`Sequence[str]`
1332 :default: :code-py:`()`
1333
1334 A list of paths that contain extra templates
1335 (or templates that overwrite builtin/theme-specific templates).
1336 Relative paths are taken as relative to the :term:`configuration directory`.
1337 Example:
1338
1339 .. code-block:: python
1340
1341 templates_path = ['.templates']
1342
1343 .. versionchanged:: 1.3
1344 As these files are not meant to be built,
1345 they are automatically excluded when discovering source files.
1346
1347
1348 Options for warning control
1349 ---------------------------
1350
1351 .. confval:: show_warning_types
1352 :type: :code-py:`bool`
1353 :default: :code-py:`True`
1354
1355 Add the type of each warning as a suffix to the warning message.
1356 For example, ``WARNING: [...] [index]`` or ``WARNING: [...] [toc.circular]``.
1357 This setting can be useful for determining which warnings types to include
1358 in a :confval:`suppress_warnings` list.
1359
1360 .. versionadded:: 7.3.0
1361 .. versionchanged:: 8.0.0
1362 The default is now :code-py:`True`.
1363
1364 .. confval:: suppress_warnings
1365 :type: :code-py:`Sequence[str]`
1366 :default: :code-py:`()`
1367
1368 A list of warning codes to suppress arbitrary warning messages.
1369
1370 .. versionadded:: 1.4
1371
1372 By default, Sphinx supports the following warning codes:
1373
1374 * ``app.add_directive``
1375 * ``app.add_generic_role``
1376 * ``app.add_node``
1377 * ``app.add_role``
1378 * ``app.add_source_parser``
1379 * ``config.cache``
1380 * ``docutils``
1381 * ``download.not_readable``
1382 * ``duplicate_declaration.c``
1383 * ``duplicate_declaration.cpp``
1384 * ``epub.duplicated_toc_entry``
1385 * ``epub.unknown_project_files``
1386 * ``i18n.babel``
1387 * ``i18n.inconsistent_references``
1388 * ``i18n.not_readable``
1389 * ``i18n.not_writeable``
1390 * ``image.not_readable``
1391 * ``index``
1392 * ``misc.copy_overwrite``
1393 * ``misc.highlighting_failure``
1394 * ``ref.any``
1395 * ``ref.citation``
1396 * ``ref.doc``
1397 * ``ref.equation``
1398 * ``ref.footnote``
1399 * ``ref.keyword``
1400 * ``ref.numref``
1401 * ``ref.option``
1402 * ``ref.python``
1403 * ``ref.ref``
1404 * ``ref.term``
1405 * ``source_code_parser.c``
1406 * ``source_code_parser.cpp``
1407 * ``toc.circular``
1408 * ``toc.duplicate_entry``
1409 * ``toc.empty_glob``
1410 * ``toc.excluded``
1411 * ``toc.no_title``
1412 * ``toc.not_included``
1413 * ``toc.not_readable``
1414 * ``toc.secnum``
1415
1416 Extensions can also define their own warning types.
1417 Those defined by the first-party ``sphinx.ext`` extensions are:
1418
1419 * ``autodoc``
1420 * ``autodoc.import_object``
1421 * ``autodoc.mocked_object``
1422 * ``autosectionlabel.<document name>``
1423 * ``autosummary``
1424 * ``autosummary.import_cycle``
1425 * ``duration``
1426 * ``intersphinx.external``
1427
1428 You can choose from these types. You can also give only the first
1429 component to exclude all warnings attached to it.
1430
1431 .. versionadded:: 1.4
1432 ``ref.citation``, ``ref.doc``, ``ref.keyword``,
1433 ``ref.numref``, ``ref.option``, ``ref.ref``, and ``ref.term``.
1434
1435 .. versionadded:: 1.4.2
1436 ``app.add_directive``, ``app.add_generic_role``,
1437 ``app.add_node``, ``app.add_role``, and ``app.add_source_parser``.
1438
1439 .. versionadded:: 1.5
1440 ``misc.highlighting_failure``.
1441
1442 .. versionadded:: 1.5.1
1443 ``epub.unknown_project_files``.
1444
1445 .. versionadded:: 1.5.2
1446 ``toc.secnum``.
1447
1448 .. versionadded:: 1.6
1449 ``ref.footnote``, ``download.not_readable``, and ``image.not_readable``.
1450
1451 .. versionadded:: 1.7
1452 ``ref.python``.
1453
1454 .. versionadded:: 2.0
1455 ``autodoc.import_object``.
1456
1457 .. versionadded:: 2.1
1458 ``autosectionlabel.<document name>``.
1459
1460 .. versionadded:: 3.1
1461 ``toc.circular``.
1462
1463 .. versionadded:: 3.3
1464 ``epub.duplicated_toc_entry``.
1465
1466 .. versionadded:: 4.3
1467 ``toc.excluded`` and ``toc.not_readable``.
1468
1469 .. versionadded:: 4.5
1470 ``i18n.inconsistent_references``.
1471
1472 .. versionadded:: 7.1
1473 ``index``.
1474
1475 .. versionadded:: 7.3
1476 ``config.cache``, ``intersphinx.external``, and ``toc.no_title``.
1477
1478 .. versionadded:: 7.4
1479 ``docutils`` and ``autosummary.import_cycle``.
1480
1481 .. versionadded:: 8.0
1482 ``misc.copy_overwrite``.
1483
1484 .. versionadded:: 8.2
1485 ``autodoc.mocked_object``,
1486 ``duplicate_declaration.c``, ``duplicate_declaration.cpp``,
1487 ``i18n.babel``, ``i18n.not_readable``, ``i18n.not_writeable``,
1488 ``ref.any``,
1489 ``toc.duplicate_entry``, ``toc.empty_glob``, and ``toc.not_included``.
1490
1491 .. versionadded:: 9.0
1492 ``duration``.
1493
1494
1495 Builder options
1496 ===============
1497
1498
1499 .. _html-options:
1500
1501 Options for HTML output
1502 -----------------------
1503
1504 These options influence HTML output.
1505 Various other builders are derived from the HTML output,
1506 and also make use of these options.
1507
1508 .. confval:: html_theme
1509 :type: :code-py:`str`
1510 :default: :code-py:`'alabaster'`
1511
1512 The theme for HTML output.
1513 See the :doc:`HTML theming section </usage/theming>`.
1514
1515 .. versionadded:: 0.6
1516 .. versionchanged:: 1.3
1517 The default theme is now :code-py:`'alabaster'`.
1518
1519 .. confval:: html_theme_options
1520 :type: :code-py:`dict[str, Any]`
1521 :default: :code-py:`{}`
1522
1523 A dictionary of options that influence the
1524 look and feel of the selected theme.
1525 These are theme-specific.
1526 The options understood by the :ref:`builtin themes
1527 <builtin-themes>` are described :ref:`here <builtin-themes>`.
1528
1529 .. versionadded:: 0.6
1530
1531 .. confval:: html_theme_path
1532 :type: :code-py:`list[str]`
1533 :default: :code-py:`[]`
1534
1535 A list of paths that contain custom themes,
1536 either as subdirectories or as zip files.
1537 Relative paths are taken as relative to the :term:`configuration directory`.
1538
1539 .. versionadded:: 0.6
1540
1541 .. confval:: html_style
1542 :type: :code-py:`Sequence[str] | str`
1543 :default: :code-py:`()`
1544
1545 Stylesheets to use for HTML pages.
1546 The stylesheet given by the selected theme is used by default
1547 A file of that name must exist either in Sphinx's :file:`static/` path
1548 or in one of the custom paths given in :confval:`html_static_path`.
1549 If you only want to add or override a few things from the theme,
1550 use CSS ``@import`` to import the theme's stylesheet.
1551
1552 .. versionchanged:: 5.1
1553 The value can be a iterable of strings.
1554
1555 .. confval:: html_title
1556 :type: :code-py:`str`
1557 :default: :samp:`'{project} {release} documentation'`
1558
1559 The "title" for HTML documentation generated with Sphinx's own templates.
1560 This is appended to the ``<title>`` tag of individual pages,
1561 and used in the navigation bar as the "topmost" element.
1562
1563 .. confval:: html_short_title
1564 :type: :code-py:`str`
1565 :default: The value of **html_title**
1566
1567 A shorter "title" for HTML documentation.
1568 This is used for links in the header and in the HTML Help documentation.
1569
1570 .. versionadded:: 0.4
1571
1572 .. confval:: html_baseurl
1573 :type: :code-py:`str`
1574 :default: :code-py:`''`
1575
1576 The base URL which points to the root of the HTML documentation.
1577 It is used to indicate the location of document using
1578 :rfc:`the Canonical Link Relation <6596>`.
1579
1580 .. versionadded:: 1.8
1581
1582 .. confval:: html_codeblock_linenos_style
1583 :type: :code-py:`'inline' | 'table'`
1584 :default: :code-py:`'inline'`
1585
1586 The style of line numbers for code-blocks.
1587
1588 :code-py:`'table'`
1589 Display line numbers using ``<table>`` tag
1590 :code-py:`'inline'`
1591 Display line numbers using ``<span>`` tag
1592
1593 .. versionadded:: 3.2
1594 .. versionchanged:: 4.0
1595 It defaults to :code-py:`'inline'`.
1596 .. deprecated:: 4.0
1597
1598 .. confval:: html_context
1599 :type: :code-py:`dict[str, Any]`
1600 :default: :code-py:`{}`
1601
1602 A dictionary of values to pass into
1603 the template engine's context for all pages.
1604 Single values can also be put in this dictionary using
1605 :program:`sphinx-build`'s :option:`--html-define
1606 <sphinx-build --html-define>` command-line option.
1607
1608 .. versionadded:: 0.5
1609
1610 .. confval:: html_logo
1611 :type: :code-py:`str`
1612 :default: :code-py:`''`
1613
1614 If given, this must be the name of an image file
1615 (path relative to the :term:`configuration directory`)
1616 that is the logo of the documentation,
1617 or a URL that points an image file for the logo.
1618 It is placed at the top of the sidebar;
1619 its width should therefore not exceed 200 pixels.
1620
1621 .. versionadded:: 0.4.1
1622 The image file will be copied to the ``_static`` directory,
1623 but only if the file does not already exist there.
1624 .. versionchanged:: 4.0
1625 Also accepts a URL.
1626
1627 .. confval:: html_favicon
1628 :type: :code-py:`str`
1629 :default: :code-py:`''`
1630
1631 If given, this must be the name of an image file
1632 (path relative to the :term:`configuration directory`)
1633 that is the favicon_ of the documentation,
1634 or a URL that points an image file for the favicon.
1635 Browsers use this as the icon for tabs, windows and bookmarks.
1636 It should be a 16-by-16 pixel icon in
1637 the PNG, SVG, GIF, or ICO file formats.
1638
1639 .. _favicon: https://developer.mozilla.org/en-US/
1640 docs/Web/HTML/Attributes/rel#icon
1641
1642 Example:
1643
1644 .. code-block:: python
1645
1646 html_favicon = 'static/favicon.png'
1647
1648 .. versionadded:: 0.4
1649 The image file will be copied to the ``_static``,
1650 but only if the file does not already exist there.
1651
1652 .. versionchanged:: 4.0
1653 Also accepts the URL for the favicon.
1654
1655 .. confval:: html_css_files
1656 :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
1657 :default: :code-py:`[]`
1658
1659 A list of CSS files.
1660 The entry must be a *filename* string
1661 or a tuple containing the *filename* string and the *attributes* dictionary.
1662 The *filename* must be relative to the :confval:`html_static_path`,
1663 or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
1664 The *attributes* dictionary is used for the ``<link>`` tag's attributes.
1665
1666 Example:
1667
1668 .. code-block:: python
1669
1670 html_css_files = [
1671 'custom.css',
1672 'https://example.com/css/custom.css',
1673 ('print.css', {'media': 'print'}),
1674 ]
1675
1676 The special attribute *priority* can be set as an integer
1677 to load the CSS file at an earlier or later step.
1678 For more information, refer to :meth:`.Sphinx.add_css_file`.
1679
1680 .. versionadded:: 1.8
1681 .. versionchanged:: 3.5
1682 Support the *priority* attribute
1683
1684 .. confval:: html_js_files
1685 :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
1686 :default: :code-py:`[]`
1687
1688 A list of JavaScript files.
1689 The entry must be a *filename* string
1690 or a tuple containing the *filename* string and the *attributes* dictionary.
1691 The *filename* must be relative to the :confval:`html_static_path`,
1692 or a full URI with scheme like :code-py:`'https://example.org/script.js'`.
1693 The *attributes* dictionary is used for the ``<script>`` tag's attributes.
1694
1695 Example:
1696
1697 .. code-block:: python
1698
1699 html_js_files = [
1700 'script.js',
1701 'https://example.com/scripts/custom.js',
1702 ('custom.js', {'async': 'async'}),
1703 ]
1704
1705 As a special attribute, *priority* can be set as an integer
1706 to load the JavaScript file at an earlier or later step.
1707 For more information, refer to :meth:`.Sphinx.add_js_file`.
1708
1709 .. versionadded:: 1.8
1710 .. versionchanged:: 3.5
1711 Support the *priority* attribute
1712
1713 .. confval:: html_static_path
1714 :type: :code-py:`list[str]`
1715 :default: :code-py:`[]`
1716
1717 A list of paths that contain custom static files
1718 (such as style sheets or script files).
1719 Relative paths are taken as relative to the :term:`configuration directory`.
1720 They are copied to the output's :file:`_static` directory
1721 after the theme's static files,
1722 so a file named :file:`default.css` will overwrite
1723 the theme's :file:`default.css`.
1724
1725 As these files are not meant to be built,
1726 they are automatically excluded from source files.
1727
1728 .. note::
1729
1730 For security reasons, dotfiles under :confval:`!html_static_path`
1731 will not be copied.
1732 If you would like to copy them intentionally,
1733 explicitly add each file to this setting:
1734
1735 .. code-block:: python
1736
1737 html_static_path = ['_static', '_static/.htaccess']
1738
1739 An alternative approach is to use :confval:`html_extra_path`,
1740 which allows copying dotfiles under the directories.
1741
1742 .. seealso::
1743
1744 :meth:`~sphinx.application.Sphinx.add_static_dir`, for use in extensions
1745 to copy static files to the output directory.
1746
1747 .. versionchanged:: 0.4
1748 The paths in :confval:`html_static_path` can now contain subdirectories.
1749
1750 .. versionchanged:: 1.0
1751 The entries in :confval:`html_static_path` can now be single files.
1752
1753 .. versionchanged:: 1.8
1754 The files under :confval:`html_static_path` are excluded from source
1755 files.
1756
1757 .. confval:: html_extra_path
1758 :type: :code-py:`list[str]`
1759 :default: :code-py:`[]`
1760
1761 A list of paths that contain extra files not directly related to
1762 the documentation,
1763 such as :file:`robots.txt` or :file:`.htaccess`.
1764 Relative paths are taken as relative to the :term:`configuration directory`.
1765 They are copied to the output directory.
1766 They will overwrite any existing file of the same name.
1767
1768 As these files are not meant to be built,
1769 they are automatically excluded from source files.
1770
1771 .. versionadded:: 1.2
1772
1773 .. versionchanged:: 1.4
1774 The dotfiles in the extra directory will be copied
1775 to the output directory.
1776 And it refers :confval:`exclude_patterns` on copying extra
1777 files and directories, and ignores if path matches to patterns.
1778
1779 .. confval:: html_last_updated_fmt
1780 :type: :code-py:`str`
1781 :default: :code-py:`None`
1782
1783 If set, a 'Last updated on:' timestamp is inserted into the page footer
1784 using the given :func:`~time.strftime` format.
1785 The empty string is equivalent to :code-py:`'%b %d, %Y'`
1786 (or a locale-dependent equivalent).
1787
1788 .. confval:: html_last_updated_use_utc
1789 :type: :code-py:`bool`
1790 :default: :code-py:`False`
1791
1792 Use GMT/UTC (+00:00) instead of the system's local time zone
1793 for the time supplied to :confval:`html_last_updated_fmt`.
1794 This is most useful when the format used includes the time.
1795
1796 .. confval:: html_permalinks
1797 :type: :code-py:`bool`
1798 :default: :code-py:`True`
1799
1800 Add link anchors for each heading and description environment.
1801
1802 .. versionadded:: 3.5
1803
1804 .. confval:: html_permalinks_icon
1805 :type: :code-py:`str`
1806 :default: :code-py:`'¶'` (the paragraph sign)
1807
1808 Text for link anchors for each heading and description environment.
1809 HTML entities and Unicode are allowed.
1810
1811 .. versionadded:: 3.5
1812
1813 .. confval:: html_sidebars
1814 :type: :code-py:`dict[str, Sequence[str]]`
1815 :default: :code-py:`{}`
1816
1817 A dictionary defining custom sidebar templates,
1818 mapping document names to template names.
1819
1820 The keys can contain `glob-style patterns`_,
1821 in which case all matching documents will get the specified sidebars.
1822 (A warning is emitted when a more than one glob-style pattern
1823 matches for any document.)
1824
1825 Each value must be a list of strings which specifies
1826 the complete list of sidebar templates to include.
1827 If all or some of the default sidebars are to be included,
1828 they must be put into this list as well.
1829
1830 The default sidebars (for documents that don't match any pattern) are
1831 defined by theme itself.
1832 The builtin themes use these templates by default:
1833 :code-py:`'localtoc.html'`, :code-py:`'relations.html'`,
1834 :code-py:`'sourcelink.html'`, and :code-py:`'searchbox.html'`.
1835
1836 The bundled first-party sidebar templates that can be rendered are:
1837
1838 * **localtoc.html** -- a fine-grained table of contents of the current
1839 document
1840 * **globaltoc.html** -- a coarse-grained table of contents for the whole
1841 documentation set, collapsed
1842 * **relations.html** -- two links to the previous and next documents
1843 * **sourcelink.html** -- a link to the source of the current document,
1844 if enabled in :confval:`html_show_sourcelink`
1845 * **searchbox.html** -- the "quick search" box
1846
1847 Example:
1848
1849 .. code-block:: python
1850
1851 html_sidebars = {
1852 '**': ['globaltoc.html', 'sourcelink.html', 'searchbox.html'],
1853 'using/windows': ['windows-sidebar.html', 'searchbox.html'],
1854 }
1855
1856 This will render the custom template ``windows-sidebar.html`` and the quick
1857 search box within the sidebar of the given document, and render the default
1858 sidebars for all other pages (except that the local TOC is replaced by the
1859 global TOC).
1860
1861 Note that this value only has no effect if
1862 the chosen theme does not possess a sidebar,
1863 like the builtin **scrolls** and **haiku** themes.
1864
1865 .. versionadded:: 1.0
1866 The ability to use globbing keys and to specify multiple sidebars.
1867
1868 .. deprecated:: 1.7
1869 A single string value for :confval:`!html_sidebars` will be removed.
1870
1871 .. versionchanged:: 2.0
1872 :confval:`!html_sidebars` must be a list of strings,
1873 and no longer accepts a single string value.
1874
1875 .. confval:: html_additional_pages
1876 :type: :code-py:`dict[str, str]`
1877 :default: :code-py:`{}`
1878
1879 Additional templates that should be rendered to HTML pages,
1880 must be a dictionary that maps document names to template names.
1881
1882 Example:
1883
1884 .. code-block:: python
1885
1886 html_additional_pages = {
1887 'download': 'custom-download.html.jinja',
1888 }
1889
1890 This will render the template :file:`custom-download.html.jinja`
1891 as the page :file:`download.html`.
1892
1893 .. confval:: html_domain_indices
1894 :type: :code-py:`bool | Sequence[str]`
1895 :default: :code-py:`True`
1896
1897 If True, generate domain-specific indices in addition to the general index.
1898 For e.g. the Python domain, this is the global module index.
1899
1900 This value can be a Boolean or a list of index names that should be generated.
1901 To find out the index name for a specific index, look at the HTML file name.
1902 For example, the Python module index has the name ``'py-modindex'``.
1903
1904 Example:
1905
1906 .. code-block:: python
1907
1908 html_domain_indices = {
1909 'py-modindex',
1910 }
1911
1912 .. versionadded:: 1.0
1913 .. versionchanged:: 7.4
1914 Permit and prefer a set type.
1915
1916 .. confval:: html_use_index
1917 :type: :code-py:`bool`
1918 :default: :code-py:`True`
1919
1920 Controls if an index is added to the HTML documents.
1921
1922 .. versionadded:: 0.4
1923
1924 .. confval:: html_split_index
1925 :type: :code-py:`bool`
1926 :default: :code-py:`False`
1927
1928 Generates two versions of the index:
1929 once as a single page with all the entries,
1930 and once as one page per starting letter.
1931
1932 .. versionadded:: 0.4
1933
1934 .. confval:: html_copy_source
1935 :type: :code-py:`bool`
1936 :default: :code-py:`True`
1937
1938 If True, the reStructuredText sources are included in the HTML build as
1939 :file:`_sources/{docname}`.
1940
1941 .. confval:: html_show_sourcelink
1942 :type: :code-py:`bool`
1943 :default: :code-py:`True`
1944
1945 If True (and :confval:`html_copy_source` is true as well),
1946 links to the reStructuredText sources will be added to the sidebar.
1947
1948 .. versionadded:: 0.6
1949
1950 .. confval:: html_sourcelink_suffix
1951 :type: :code-py:`str`
1952 :default: :code-py:`'.txt'`
1953
1954 The suffix to append to source links
1955 (see :confval:`html_show_sourcelink`),
1956 unless files they have this suffix already.
1957
1958 .. versionadded:: 1.5
1959
1960 .. confval:: html_use_opensearch
1961 :type: :code-py:`str`
1962 :default: :code-py:`''`
1963
1964 If nonempty, an `OpenSearch <https://github.com/dewitt/opensearch>`_
1965 description file will be output,
1966 and all pages will contain a ``<link>`` tag referring to it.
1967 Since OpenSearch doesn't support relative URLs for its search page location,
1968 the value of this option must be the base URL
1969 from which these documents are served (without trailing slash),
1970 e.g. :code-py:`'https://docs.python.org'`.
1971
1972 .. versionadded:: 0.2
1973
1974 .. confval:: html_file_suffix
1975 :type: :code-py:`str`
1976 :default: :code-py:`'.html'`
1977
1978 The file name suffix (file extension) for generated HTML files.
1979
1980 .. versionadded:: 0.4
1981
1982 .. confval:: html_link_suffix
1983 :type: :code-py:`str`
1984 :default: The value of **html_file_suffix**
1985
1986 The suffix for generated links to HTML files.
1987 Intended to support more esoteric server setups.
1988
1989 .. versionadded:: 0.6
1990
1991 .. confval:: html_show_copyright
1992 :type: :code-py:`bool`
1993 :default: :code-py:`True`
1994
1995 If True, "© Copyright ..." is shown in the HTML footer,
1996 with the value or values from :confval:`copyright`.
1997
1998 .. versionadded:: 1.0
1999
2000 .. confval:: html_show_search_summary
2001 :type: :code-py:`bool`
2002 :default: :code-py:`True`
2003
2004 Show a summary of the search result, i.e., the text around the keyword.
2005
2006 .. versionadded:: 4.5
2007
2008 .. confval:: html_show_sphinx
2009 :type: :code-py:`bool`
2010 :default: :code-py:`True`
2011
2012 Add "Created using Sphinx_" to the HTML footer.
2013
2014 .. _Sphinx: https://www.sphinx-doc.org/
2015
2016 .. versionadded:: 0.4
2017
2018 .. confval:: html_output_encoding
2019 :type: :code-py:`str`
2020 :default: :code-py:`'utf-8'`
2021
2022 Encoding of HTML output files.
2023 This encoding name must both be a valid Python encoding name
2024 and a valid HTML ``charset`` value.
2025
2026 .. versionadded:: 1.0
2027
2028 .. confval:: html_compact_lists
2029 :type: :code-py:`bool`
2030 :default: :code-py:`True`
2031
2032 If True, a list all whose items consist of a single paragraph and/or a
2033 sub-list all whose items etc... (recursive definition) will not use the
2034 ``<p>`` element for any of its items. This is standard docutils behaviour.
2035 Default: :code-py:`True`.
2036
2037 .. versionadded:: 1.0
2038
2039 .. confval:: html_secnumber_suffix
2040 :type: :code-py:`str`
2041 :default: :code-py:`'. '`
2042
2043 Suffix for section numbers in HTML output.
2044 Set to :code-py:`' '` to suppress the final dot on section numbers.
2045
2046 .. versionadded:: 1.0
2047
2048 .. confval:: html_search_language
2049 :type: :code-py:`str`
2050 :default: The value of **language**
2051
2052 Language to be used for generating the HTML full-text search index.
2053 This defaults to the global language selected with :confval:`language`.
2054 English (:code-py:`'en'`) is used as a fall-back option
2055 if there is no support for this language.
2056
2057 Support exists for the following languages:
2058
2059 * ``da`` -- Danish
2060 * ``nl`` -- Dutch
2061 * ``en`` -- English
2062 * ``fi`` -- Finnish
2063 * ``fr`` -- French
2064 * ``de`` -- German
2065 * ``hu`` -- Hungarian
2066 * ``it`` -- Italian
2067 * ``ja`` -- Japanese
2068 * ``no`` -- Norwegian
2069 * ``pt`` -- Portuguese
2070 * ``ro`` -- Romanian
2071 * ``ru`` -- Russian
2072 * ``es`` -- Spanish
2073 * ``sv`` -- Swedish
2074 * ``tr`` -- Turkish
2075 * ``zh`` -- Chinese
2076
2077 .. tip:: Accelerating build speed
2078
2079 Each language (except Japanese) provides its own stemming algorithm.
2080 Sphinx uses a Python implementation by default.
2081 If you want to accelerate building the index file,
2082 you can use a third-party package (PyStemmer_) by running
2083 :command:`pip install PyStemmer`.
2084
2085 .. _PyStemmer: https://pypi.org/project/PyStemmer/
2086
2087 .. versionadded:: 1.1
2088 Support English (``en``) and Japanese (``ja``).
2089
2090 .. versionchanged:: 1.3
2091 Added additional languages.
2092
2093 .. confval:: html_search_options
2094 :type: :code-py:`dict[str, str]`
2095 :default: :code-py:`{}`
2096
2097 A dictionary with options for the search language support.
2098 The meaning of these options depends on the language selected.
2099 Currently, only Japanese and Chinese support options.
2100
2101 :Japanese:
2102 ``type`` -- the type of the splitter to use.
2103 The other options depend on the splitter used.
2104
2105 :code-py:`'sphinx.search.ja.DefaultSplitter'`
2106 The TinySegmenter algorithm, used by default.
2107 :code-py:`'sphinx.search.ja.MecabSplitter'`:
2108 The MeCab binding
2109 To use this splitter, the 'mecab' python binding
2110 or dynamic link library
2111 ('libmecab.so' for Linux, 'libmecab.dll' for Windows) is required.
2112 :code-py:`'sphinx.search.ja.JanomeSplitter'`:
2113 The Janome binding.
2114 To use this splitter,
2115 `Janome <https://pypi.org/project/Janome/>`_ is required.
2116
2117
2118 .. deprecated:: 1.6
2119 ``'mecab'``, ``'janome'`` and ``'default'`` is deprecated.
2120 To keep compatibility,
2121 ``'mecab'``, ``'janome'`` and ``'default'`` are also acceptable.
2122
2123 Options for :code-py:`'mecab'`:
2124 :dic_enc:
2125 _`dic_enc option` is the encoding for the MeCab algorithm.
2126 :dict:
2127 _`dict option` is the dictionary to use for the MeCab algorithm.
2128 :lib:
2129 _`lib option` is the library name for finding the MeCab library
2130 via ``ctypes`` if the Python binding is not installed.
2131
2132 For example:
2133
2134 .. code-block:: python
2135
2136 html_search_options = {
2137 'type': 'mecab',
2138 'dic_enc': 'utf-8',
2139 'dict': '/path/to/mecab .dic',
2140 'lib': '/path/to/libmecab.so',
2141 }
2142
2143 Options for :code-py:`'janome'`:
2144 :user_dic:
2145 _`user_dic option` is the user dictionary file path for Janome.
2146 :user_dic_enc:
2147 _`user_dic_enc option` is the encoding for
2148 the user dictionary file specified by ``user_dic`` option.
2149 Default is 'utf8'.
2150
2151 :Chinese:
2152 ``dict``
2153 The ``jieba`` dictionary path for using a custom dictionary.
2154
2155 .. versionadded:: 1.1
2156
2157 .. versionchanged:: 1.4
2158 Allow any custom splitter in the *type* setting for Japanese.
2159
2160 .. confval:: html_search_scorer
2161 :type: :code-py:`str`
2162 :default: :code-py:`''`
2163
2164 The name of a JavaScript file
2165 (relative to the :term:`configuration directory`)
2166 that implements a search results scorer.
2167 If empty, the default will be used.
2168
2169 The scorer must implement the following interface,
2170 and may optionally define the :code-js:`score()` function
2171 for more granular control.
2172
2173 .. code-block:: javascript
2174
2175 const Scorer = {
2176 // Implement the following function to further tweak the score for each result
2177 score: result => {
2178 const [docName, title, anchor, descr, score, filename] = result
2179
2180 // ... calculate a new score ...
2181 return score
2182 },
2183
2184 // query matches the full name of an object
2185 objNameMatch: 11,
2186 // or matches in the last dotted part of the object name
2187 objPartialMatch: 6,
2188 // Additive scores depending on the priority of the object
2189 objPrio: {
2190 0: 15, // used to be importantResults
2191 1: 5, // used to be objectResults
2192 2: -5, // used to be unimportantResults
2193 },
2194 // Used when the priority is not in the mapping.
2195 objPrioDefault: 0,
2196
2197 // query found in title
2198 title: 15,
2199 partialTitle: 7,
2200
2201 // query found in terms
2202 term: 5,
2203 partialTerm: 2,
2204 };
2205
2206 .. versionadded:: 1.2
2207
2208 .. confval:: html_scaled_image_link
2209 :type: :code-py:`bool`
2210 :default: :code-py:`True`
2211
2212 Link images that have been resized with a
2213 scale option (*scale*, *width*, or *height*)
2214 to their original full-resolution image.
2215 This will not overwrite any link given by the *target* option
2216 on the the :dudir:`image` directive, if present.
2217
2218 .. tip::
2219
2220 To disable this feature on a per-image basis,
2221 add the ``no-scaled-link`` class to the image directive:
2222
2223 .. code-block:: rst
2224
2225 .. image:: sphinx.png
2226 :scale: 50%
2227 :class: no-scaled-link
2228
2229 .. versionadded:: 1.3
2230
2231 .. versionchanged:: 3.0
2232 Images with the ``no-scaled-link`` class will not be linked.
2233
2234 .. confval:: html_math_renderer
2235 :type: :code-py:`str`
2236 :default: :code-py:`'mathjax'`
2237
2238 The maths renderer to use for HTML output.
2239 The bundled renders are *mathjax* and *imgmath*.
2240 You must also load the relevant extension in :confval:`extensions`.
2241
2242 .. versionadded:: 1.8
2243
2244
2245 Options for Single HTML output
2246 -------------------------------
2247
2248 These options influence Single HTML output.
2249 This builder derives from the HTML builder,
2250 so the HTML options also apply where appropriate.
2251
2252 .. confval:: singlehtml_sidebars
2253 :type: :code-py:`dict[str, Sequence[str]]`
2254 :default: The value of **html_sidebars**
2255
2256 A dictionary defining custom sidebar templates,
2257 mapping document names to template names.
2258
2259 This has the same effect as :confval:`html_sidebars`,
2260 but the only permitted key is :code-py:`'index'`,
2261 and all other keys are ignored.
2262
2263
2264 .. _htmlhelp-options:
2265
2266 Options for HTML help output
2267 -----------------------------
2268
2269 These options influence HTML help output.
2270 This builder derives from the HTML builder,
2271 so the HTML options also apply where appropriate.
2272
2273 .. confval:: htmlhelp_basename
2274 :type: :code-py:`str`
2275 :default: :code-py:`'{project}doc'`
2276
2277 Output file base name for HTML help builder.
2278 The default is the :confval:`project name <project>`
2279 with spaces removed and ``doc`` appended.
2280
2281 .. confval:: htmlhelp_file_suffix
2282 :type: :code-py:`str`
2283 :default: :code-py:`'.html'`
2284
2285 This is the file name suffix for generated HTML help files.
2286
2287 .. versionadded:: 2.0
2288
2289 .. confval:: htmlhelp_link_suffix
2290 :type: :code-py:`str`
2291 :default: The value of **htmlhelp_file_suffix**
2292
2293 Suffix for generated links to HTML files.
2294
2295 .. versionadded:: 2.0
2296
2297
2298 .. _applehelp-options:
2299
2300 Options for Apple Help output
2301 -----------------------------
2302
2303 .. versionadded:: 1.3
2304
2305 These options influence Apple Help output.
2306 This builder derives from the HTML builder,
2307 so the HTML options also apply where appropriate.
2308
2309 .. note::
2310
2311 Apple Help output will only work on Mac OS X 10.6 and higher,
2312 as it requires the :program:`hiutil` and :program:`codesign`
2313 command-line tools, neither of which are Open Source.
2314
2315 You can disable the use of these tools using
2316 :confval:`applehelp_disable_external_tools`,
2317 but the result will not be a valid help book
2318 until the indexer is run over the ``.lproj`` directories within the bundle.
2319
2320 .. TODO: Is this warning still relevant as of 2024-07?
2321 Needs updating by someone with a Mac.
2322
2323 .. confval:: applehelp_bundle_name
2324 :type: :code-py:`str`
2325 :default: The value of **project**
2326
2327 The basename for the Apple Help Book.
2328 The default is the :confval:`project name <project>`
2329 with spaces removed.
2330
2331 .. confval:: applehelp_bundle_id
2332 :type: :code-py:`str`
2333 :default: :code-py:`None`
2334
2335 The bundle ID for the help book bundle.
2336
2337 .. warning::
2338
2339 You *must* set this value in order to generate Apple Help.
2340
2341 .. confval:: applehelp_bundle_version
2342 :type: :code-py:`str`
2343 :default: :code-py:`'1'`
2344
2345 The bundle version, as a string.
2346
2347 .. confval:: applehelp_dev_region
2348 :type: :code-py:`str`
2349 :default: :code-py:`'en-us'`
2350
2351 The development region.
2352 Defaults to Apple’s recommended setting, :code-py:`'en-us'`.
2353
2354 .. confval:: applehelp_icon
2355 :type: :code-py:`str`
2356 :default: :code-py:`None`
2357
2358 Path to the help bundle icon file or :code-py:`None` for no icon.
2359 According to Apple's documentation,
2360 this should be a 16-by-16 pixel version of the application's icon
2361 with a transparent background, saved as a PNG file.
2362
2363 .. confval:: applehelp_kb_product
2364 :type: :code-py:`str`
2365 :default: :samp:`'{project}-{release}'`
2366
2367 The product tag for use with :confval:`applehelp_kb_url`.
2368
2369 .. confval:: applehelp_kb_url
2370 :type: :code-py:`str`
2371 :default: :code-py:`None`
2372
2373 The URL for your knowledgebase server,
2374 e.g. ``https://example.com/kbsearch.py?p='product'&q='query'&l='lang'``.
2375 At runtime, Help Viewer will replace
2376 ``'product'`` with the contents of :confval:`applehelp_kb_product`,
2377 ``'query'`` with the text entered by the user in the search box,
2378 and ``'lang'`` with the user's system language.
2379
2380 Set this to to :code-py:`None` to disable remote search.
2381
2382 .. confval:: applehelp_remote_url
2383 :type: :code-py:`str`
2384 :default: :code-py:`None`
2385
2386 The URL for remote content.
2387 You can place a copy of your Help Book's ``Resources`` directory
2388 at this location and Help Viewer will attempt to use it
2389 to fetch updated content.
2390
2391 For example, if you set it to ``https://example.com/help/Foo/``
2392 and Help Viewer wants a copy of ``index.html`` for
2393 an English speaking customer,
2394 it will look at ``https://example.com/help/Foo/en.lproj/index.html``.
2395
2396 Set this to to :code-py:`None` for no remote content.
2397
2398 .. confval:: applehelp_index_anchors
2399 :type: :code-py:`bool`
2400 :default: :code-py:`False`
2401
2402 Tell the help indexer to index anchors in the generated HTML.
2403 This can be useful for jumping to a particular topic
2404 using the ``AHLookupAnchor`` function
2405 or the ``openHelpAnchor:inBook:`` method in your code.
2406 It also allows you to use ``help:anchor`` URLs;
2407 see the Apple documentation for more information on this topic.
2408
2409 .. confval:: applehelp_min_term_length
2410 :type: :code-py:`str`
2411 :default: :code-py:`None`
2412
2413 Controls the minimum term length for the help indexer.
2414 If :code-py:`None`, use the default length.
2415
2416 .. confval:: applehelp_stopwords
2417 :type: :code-py:`str`
2418 :default: The value of **language**
2419
2420 Either a language specification (to use the built-in stopwords),
2421 or the path to a stopwords plist,
2422 or :code-py:`None` if you do not want to use stopwords.
2423 The default stopwords plist can be found at
2424 ``/usr/share/hiutil/Stopwords.plist``
2425 and contains, at time of writing, stopwords for the following languages:
2426
2427 * German (``de``)
2428 * English (``en``)
2429 * Spanish (``es``)
2430 * French (``fr``)
2431 * Hungarian (``hu``)
2432 * Italian (``it``)
2433 * Swedish (``sv``)
2434
2435 .. confval:: applehelp_locale
2436 :type: :code-py:`str`
2437 :default: The value of **language**
2438
2439 Specifies the locale to generate help for.
2440 This is used to determine the name of the ``.lproj`` directory
2441 inside the Help Book’s ``Resources``,
2442 and is passed to the help indexer.
2443
2444 .. confval:: applehelp_title
2445 :type: :code-py:`str`
2446 :default: :samp:`'{project} Help'`
2447
2448 Specifies the help book title.
2449
2450 .. confval:: applehelp_codesign_identity
2451 :type: :code-py:`str`
2452 :default: The value of **CODE_SIGN_IDENTITY**
2453
2454 Specifies the identity to use for code signing.
2455 Use :code-py:`None` if code signing is not to be performed.
2456
2457 Defaults to the value of the :envvar:`!CODE_SIGN_IDENTITY`
2458 environment variable, which is set by Xcode for script build phases,
2459 or :code-py:`None` if that variable is not set.
2460
2461 .. confval:: applehelp_codesign_flags
2462 :type: :code-py:`list[str]`
2463 :default: The value of **OTHER_CODE_SIGN_FLAGS**
2464
2465 A *list* of additional arguments to pass to :program:`codesign` when
2466 signing the help book.
2467
2468 Defaults to a list based on the value of the :envvar:`!OTHER_CODE_SIGN_FLAGS`
2469 environment variable, which is set by Xcode for script build phases,
2470 or the empty list if that variable is not set.
2471
2472 .. confval:: applehelp_codesign_path
2473 :type: :code-py:`str`
2474 :default: :code-py:`'/usr/bin/codesign'`
2475
2476 The path to the :program:`codesign` program.
2477
2478 .. confval:: applehelp_indexer_path
2479 :type: :code-py:`str`
2480 :default: :code-py:`'/usr/bin/hiutil'`
2481
2482 The path to the :program:`hiutil` program.
2483
2484 .. confval:: applehelp_disable_external_tools
2485 :type: :code-py:`bool`
2486 :default: :code-py:`False`
2487
2488 Do not run the indexer or the code signing tool,
2489 no matter what other settings are specified.
2490
2491 This is mainly useful for testing,
2492 or where you want to run the Sphinx build on a non-macOS platform
2493 and then complete the final steps on a Mac for some reason.
2494
2495
2496 .. _epub-options:
2497
2498 Options for EPUB output
2499 -----------------------
2500
2501 These options influence EPUB output.
2502 This builder derives from the HTML builder,
2503 so the HTML options also apply where appropriate.
2504
2505 .. note::
2506 The actual value for some of these options is not important,
2507 but they are required for the `Dublin Core metadata`_.
2508
2509 .. _Dublin Core metadata: https://dublincore.org/
2510
2511 .. confval:: epub_basename
2512 :type: :code-py:`str`
2513 :default: The value of **project**
2514
2515 The basename for the EPUB file.
2516
2517 .. confval:: epub_theme
2518 :type: :code-py:`str`
2519 :default: :code-py:`'epub'`
2520
2521 The HTML theme for the EPUB output. Since the default themes are not
2522 optimised for small screen space, using the same theme for HTML and EPUB
2523 output is usually not wise.
2524 This defaults to :code-py:`'epub'`,
2525 a theme designed to save visual space.
2526
2527 .. confval:: epub_theme_options
2528 :type: :code-py:`dict[str, Any]`
2529 :default: :code-py:`{}`
2530
2531 A dictionary of options that influence the
2532 look and feel of the selected theme.
2533 These are theme-specific.
2534 The options understood by the :ref:`builtin themes
2535 <builtin-themes>` are described :ref:`here <builtin-themes>`.
2536
2537 .. versionadded:: 1.2
2538
2539 .. confval:: epub_title
2540 :type: :code-py:`str`
2541 :default: The value of **project**
2542
2543 The title of the document.
2544
2545 .. versionchanged:: 2.0
2546 It defaults to the :confval:`!project` option
2547 (previously :confval:`!html_title`).
2548
2549 .. confval:: epub_description
2550 :type: :code-py:`str`
2551 :default: :code-py:`'unknown'`
2552
2553 The description of the document.
2554
2555 .. versionadded:: 1.4
2556
2557 .. versionchanged:: 1.5
2558 Renamed from :confval:`!epub3_description`
2559
2560 .. confval:: epub_author
2561 :type: :code-py:`str`
2562 :default: The value of **author**
2563
2564 The author of the document.
2565 This is put in the Dublin Core metadata.
2566
2567 .. confval:: epub_contributor
2568 :type: :code-py:`str`
2569 :default: :code-py:`'unknown'`
2570
2571 The name of a person, organisation, etc. that played a secondary role
2572 in the creation of the content of an EPUB Publication.
2573
2574 .. versionadded:: 1.4
2575
2576 .. versionchanged:: 1.5
2577 Renamed from :confval:`!epub3_contributor`
2578
2579 .. confval:: epub_language
2580 :type: :code-py:`str`
2581 :default: The value of **language**
2582
2583 The language of the document.
2584 This is put in the Dublin Core metadata.
2585
2586 .. confval:: epub_publisher
2587 :type: :code-py:`str`
2588 :default: The value of **author**
2589
2590 The publisher of the document.
2591 This is put in the Dublin Core metadata.
2592 You may use any sensible string, e.g. the project homepage.
2593
2594 .. confval:: epub_copyright
2595 :type: :code-py:`str`
2596 :default: The value of **copyright**
2597
2598 The copyright of the document.
2599 See :confval:`copyright` for permitted formats.
2600
2601 .. confval:: epub_identifier
2602 :type: :code-py:`str`
2603 :default: :code-py:`'unknown'`
2604
2605 An identifier for the document.
2606 This is put in the Dublin Core metadata.
2607 For published documents this is the ISBN number,
2608 but you can also use an alternative scheme, e.g. the project homepage.
2609
2610 .. confval:: epub_scheme
2611 :type: :code-py:`str`
2612 :default: :code-py:`'unknown'`
2613
2614 The publication scheme for the :confval:`epub_identifier`.
2615 This is put in the Dublin Core metadata.
2616 For published books the scheme is ``'ISBN'``.
2617 If you use the project homepage, ``'URL'`` seems reasonable.
2618
2619 .. confval:: epub_uid
2620 :type: :code-py:`str`
2621 :default: :code-py:`'unknown'`
2622
2623 A unique identifier for the document.
2624 This is put in the Dublin Core metadata.
2625 You may use a `XML's Name format`_ string.
2626 You can't use hyphen, period, numbers as a first character.
2627
2628 .. _XML's Name format: https://www.w3.org/TR/REC-xml/#NT-NameStartChar
2629
2630 .. confval:: epub_cover
2631 :type: :code-py:`tuple[str, str]`
2632 :default: :code-py:`()`
2633
2634 The cover page information.
2635 This is a tuple containing the filenames of the cover image
2636 and the html template.
2637 The rendered html cover page is inserted as the first item
2638 in the spine in :file:`content.opf`.
2639 If the template filename is empty, no html cover page is created.
2640 No cover at all is created if the tuple is empty.
2641
2642 Examples:
2643
2644 .. code-block:: python
2645
2646 epub_cover = ('_static/cover.png', 'epub-cover.html')
2647 epub_cover = ('_static/cover.png', '')
2648 epub_cover = ()
2649
2650 .. versionadded:: 1.1
2651
2652 .. confval:: epub_css_files
2653 :type: :code-py:`Sequence[str | tuple[str, dict[str, str]]]`
2654 :default: :code-py:`[]`
2655
2656 A list of CSS files.
2657 The entry must be a *filename* string
2658 or a tuple containing the *filename* string and the *attributes* dictionary.
2659 The *filename* must be relative to the :confval:`html_static_path`,
2660 or a full URI with scheme like :code-py:`'https://example.org/style.css'`.
2661 The *attributes* dictionary is used for the ``<link>`` tag's attributes.
2662 For more information, see :confval:`html_css_files`.
2663
2664 .. versionadded:: 1.8
2665
2666 .. confval:: epub_guide
2667 :type: :code-py:`Sequence[tuple[str, str, str]]`
2668 :default: :code-py:`()`
2669
2670 Meta data for the guide element of :file:`content.opf`.
2671 This is a sequence of tuples containing
2672 the *type*, the *uri* and the *title* of the optional guide information.
2673 See `the OPF documentation <https://idpf.org/epub>`_ for details.
2674 If possible, default entries for the *cover* and *toc* types
2675 are automatically inserted.
2676 However, the types can be explicitly overwritten
2677 if the default entries are not appropriate.
2678
2679 Example:
2680
2681 .. code-block:: python
2682
2683 epub_guide = (
2684 ('cover', 'cover.html', 'Cover Page'),
2685 )
2686
2687 The default value is :code-py:`()`.
2688
2689 .. confval:: epub_pre_files
2690 :type: :code-py:`Sequence[tuple[str, str]]`
2691 :default: :code-py:`()`
2692
2693 Additional files that should be inserted before the text generated by Sphinx.
2694 It is a list of tuples containing the file name and the title.
2695 If the title is empty, no entry is added to :file:`toc.ncx`.
2696
2697 Example:
2698
2699 .. code-block:: python
2700
2701 epub_pre_files = [
2702 ('index.html', 'Welcome'),
2703 ]
2704
2705 .. confval:: epub_post_files
2706 :type: :code-py:`Sequence[tuple[str, str]]`
2707 :default: :code-py:`()`
2708
2709 Additional files that should be inserted after the text generated by Sphinx.
2710 It is a list of tuples containing the file name and the title.
2711 This option can be used to add an appendix.
2712 If the title is empty, no entry is added to :file:`toc.ncx`.
2713
2714 Example:
2715
2716 .. code-block:: python
2717
2718 epub_post_files = [
2719 ('appendix.xhtml', 'Appendix'),
2720 ]
2721
2722 .. confval:: epub_exclude_files
2723 :type: :code-py:`Sequence[str]`
2724 :default: :code-py:`[]`
2725
2726 A sequence of files that are generated/copied in the build directory
2727 but should not be included in the EPUB file.
2728
2729 .. confval:: epub_tocdepth
2730 :type: :code-py:`int`
2731 :default: :code-py:`3`
2732
2733 The depth of the table of contents in the file :file:`toc.ncx`.
2734 It should be an integer greater than zero.
2735
2736 .. tip::
2737 A deeply nested table of contents may be difficult to navigate.
2738
2739 .. confval:: epub_tocdup
2740 :type: :code-py:`bool`
2741 :default: :code-py:`True`
2742
2743 This flag determines if a ToC entry is inserted again
2744 at the beginning of its nested ToC listing.
2745 This allows easier navigation to the top of a chapter,
2746 but can be confusing because it mixes entries of different depth in one list.
2747
2748 .. confval:: epub_tocscope
2749 :type: :code-py:`'default' | 'includehidden'`
2750 :default: :code-py:`'default'`
2751
2752 This setting control the scope of the EPUB table of contents.
2753 The setting can have the following values:
2754
2755 :code-py:`'default'`
2756 Include all ToC entries that are not hidden
2757 :code-py:`'includehidden'`
2758 Include all ToC entries
2759
2760 .. versionadded:: 1.2
2761
2762 .. confval:: epub_fix_images
2763 :type: :code-py:`bool`
2764 :default: :code-py:`False`
2765
2766 Try and fix image formats that are not supported by some EPUB readers.
2767 At the moment palette images with a small colour table are upgraded.
2768 This is disabled by default because the
2769 automatic conversion may lose information.
2770 You need the Python Image Library (Pillow_) installed to use this option.
2771
2772 .. _Pillow: https://pypi.org/project/Pillow/
2773
2774 .. versionadded:: 1.2
2775
2776 .. confval:: epub_max_image_width
2777 :type: :code-py:`int`
2778 :default: :code-py:`0`
2779
2780 This option specifies the maximum width of images.
2781 If it is set to a valuevgreater than zero,
2782 images with a width larger than the given value are scaled accordingly.
2783 If it is zero, no scaling is performed.
2784 You need the Python Image Library (Pillow_) installed to use this option.
2785
2786 .. _Pillow: https://pypi.org/project/Pillow/
2787
2788 .. versionadded:: 1.2
2789
2790 .. confval:: epub_show_urls
2791 :type: :code-py:`'footnote' | 'no' | 'inline'`
2792 :default: :code-py:`'footnote'`
2793
2794 Control how to display URL addresses.
2795 This is very useful for readers that have no other means
2796 to display the linked URL.
2797 The setting can have the following values:
2798
2799 :code-py:`'inline'`
2800 Display URLs inline in parentheses.
2801 :code-py:`'footnote'`
2802 Display URLs in footnotes.
2803 :code-py:`'no'`
2804 Do not display URLs.
2805
2806 The display of inline URLs can be customised by adding CSS rules
2807 for the class ``link-target``.
2808
2809 .. versionadded:: 1.2
2810
2811 .. confval:: epub_use_index
2812 :type: :code-py:`bool`
2813 :default: The value of **html_use_index**
2814
2815 Add an index to the EPUB document.
2816
2817 .. versionadded:: 1.2
2818
2819 .. confval:: epub_writing_mode
2820 :type: :code-py:`'horizontal' | 'vertical'`
2821 :default: :code-py:`'horizontal'`
2822
2823 It specifies writing direction.
2824 It can accept :code-py:`'horizontal'` and :code-py:`'vertical'`
2825
2826 .. list-table::
2827 :align: left
2828 :header-rows: 1
2829 :stub-columns: 1
2830
2831 * - ``epub_writing_mode``
2832 - ``'horizontal'``
2833 - ``'vertical'``
2834 * - writing-mode_
2835 - ``horizontal-tb``
2836 - ``vertical-rl``
2837 * - page progression
2838 - left to right
2839 - right to left
2840 * - iBook's Scroll Theme support
2841 - scroll-axis is vertical.
2842 - scroll-axis is horizontal.
2843
2844 .. _writing-mode: https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode
2845
2846
2847 .. _latex-options:
2848
2849 Options for LaTeX output
2850 ------------------------
2851
2852 These options influence LaTeX output.
2853
2854 .. confval:: latex_engine
2855 :type: :code-py:`'pdflatex' | 'xelatex' | 'lualatex' | 'platex' | 'uplatex'`
2856 :default: :code-py:`'pdflatex'`
2857
2858 The LaTeX engine to build the documentation.
2859 The setting can have the following values:
2860
2861 * :code-py:`'pdflatex'` -- PDFLaTeX (default)
2862 * :code-py:`'xelatex'` -- XeLaTeX
2863 (default if :confval:`language` is one of ``el``, ``zh_CN``, or ``zh_TW``)
2864 * :code-py:`'lualatex'` -- LuaLaTeX
2865 * :code-py:`'platex'` -- pLaTeX
2866 * :code-py:`'uplatex'` -- upLaTeX
2867 (default if :confval:`language` is :code-py:`'ja'`)
2868
2869 .. important::
2870
2871 ``'pdflatex'``\ 's support for Unicode characters is limited.
2872 If your project uses Unicode characters,
2873 setting the engine to ``'xelatex'`` or ``'lualatex'``
2874 and making sure to use an OpenType font with wide-enough glyph coverage
2875 is often easier than trying to make ``'pdflatex'`` work
2876 with the extra Unicode characters.
2877 Since Sphinx 2.0, the default typeface is GNU FreeFont,
2878 which has good coverage of Latin, Cyrillic, and Greek glyphs.
2879
2880 .. note::
2881
2882 Sphinx 2.0 adds support for occasional Cyrillic and Greek letters or
2883 words in documents using a Latin language and ``'pdflatex'``. To enable
2884 this, the :ref:`fontenc` key of :ref:`latex_elements
2885 <latex_elements_confval>` must be used appropriately.
2886
2887 .. note::
2888
2889 Contrarily to :ref:`MathJaX math rendering in HTML output <math-support>`,
2890 LaTeX requires some extra configuration to support Unicode literals in
2891 :rst:dir:`math`:
2892 the only comprehensive solution (as far as we know) is to
2893 use ``'xelatex'`` or ``'lualatex'`` *and* to add
2894 ``r'\usepackage{unicode-math}'``
2895 (e.g. via the :ref:`preamble` key of :ref:`latex_elements
2896 <latex_elements_confval>`).
2897 You may prefer ``r'\usepackage[math-style=literal]{unicode-math}'``
2898 to keep a Unicode literal such as ``α`` (U+03B1) as-is in output,
2899 rather than being rendered as :math:`\alpha`.
2900
2901 .. versionchanged:: 2.1.0
2902 Use ``'xelatex'`` (and LaTeX package ``xeCJK``)
2903 by default for Chinese documents.
2904
2905 .. versionchanged:: 2.2.1
2906 Use ``'xelatex'`` by default for Greek documents.
2907
2908 .. versionchanged:: 2.3
2909 Add ``'uplatex'`` support.
2910
2911 .. versionchanged:: 4.0
2912 Use ``'uplatex'`` by default for Japanese documents.
2913
2914 .. confval:: latex_documents
2915 :type: :code-py:`Sequence[tuple[str, str, str, str, str, bool]]`
2916 :default: The default LaTeX documents
2917
2918 This value determines how to group the document tree
2919 into LaTeX source files.
2920 It must be a list of tuples ``(startdocname, targetname, title, author,
2921 theme, toctree_only)``,
2922 where the items are:
2923
2924 *startdocname*
2925 String that specifies the :term:`document name` of
2926 the LaTeX file's master document.
2927 All documents referenced by the *startdoc* document in
2928 ToC trees will be included in the LaTeX file.
2929 (If you want to use the default master document for your LaTeX build,
2930 provide your :confval:`master_doc` here.)
2931
2932 *targetname*
2933 File name of the LaTeX file in the output directory.
2934
2935 *title*
2936 LaTeX document title.
2937 Can be empty to use the title of the *startdoc* document.
2938 This is inserted as LaTeX markup,
2939 so special characters like a backslash or ampersand
2940 must be represented by the proper LaTeX commands
2941 if they are to be inserted literally.
2942
2943 *author*
2944 Author for the LaTeX document.
2945 The same LaTeX markup caveat as for *title* applies.
2946 Use ``\\and`` to separate multiple authors, as in: ``'John \\and Sarah'``
2947 (backslashes must be Python-escaped to reach LaTeX).
2948
2949 *theme*
2950 LaTeX theme.
2951 See :confval:`latex_theme`.
2952
2953 *toctree_only*
2954 Must be :code-py:`True` or :code-py:`False`.
2955 If True, the *startdoc* document itself is not included in the output,
2956 only the documents referenced by it via ToC trees.
2957 With this option, you can put extra stuff in the master document
2958 that shows up in the HTML, but not the LaTeX output.
2959
2960 .. versionadded:: 0.3
2961 The 6th item ``toctree_only``.
2962 Tuples with 5 items are still accepted.
2963
2964 .. versionadded:: 1.2
2965 In the past including your own document class required you to prepend the
2966 document class name with the string "sphinx".
2967 This is not necessary anymore.
2968
2969 .. confval:: latex_logo
2970 :type: :code-py:`str`
2971 :default: :code-py:`''`
2972
2973 If given, this must be the name of an image file
2974 (path relative to the :term:`configuration directory`)
2975 that is the logo of the documentation.
2976 It is placed at the top of the title page.
2977
2978 .. confval:: latex_toplevel_sectioning
2979 :type: :code-py:`'part' | 'chapter' | 'section'`
2980 :default: :code-py:`None`
2981
2982 This value determines the topmost sectioning unit. The default setting is
2983 ``'section'`` if :confval:`latex_theme` is ``'howto'``, and ``'chapter'``
2984 if it is ``'manual'``. The alternative in both cases is to specify
2985 ``'part'``, which means that LaTeX document will use the :code-tex:`\\part`
2986 command.
2987
2988 In that case the numbering of sectioning units one level deep gets off-sync
2989 with HTML numbering, as by default LaTeX does not reset
2990 :code-tex:`\\chapter` numbering (or :code-tex:`\\section` for ``'howto'``
2991 theme) when encountering :code-tex:`\\part` command.
2992
2993 .. versionadded:: 1.4
2994
2995 .. confval:: latex_appendices
2996 :type: :code-py:`Sequence[str]`
2997 :default: :code-py:`()`
2998
2999 A list of document names to append as an appendix to all manuals.
3000 This is ignored if :confval:`latex_theme` is set to :code-py:`'howto'`.
3001
3002 .. confval:: latex_domain_indices
3003 :type: :code-py:`bool | Sequence[str]`
3004 :default: :code-py:`True`
3005
3006 If True, generate domain-specific indices in addition to the general index.
3007 For e.g. the Python domain, this is the global module index.
3008
3009 This value can be a Boolean or a list of index names that should be generated.
3010 To find out the index name for a specific index, look at the HTML file name.
3011 For example, the Python module index has the name ``'py-modindex'``.
3012
3013 Example:
3014
3015 .. code-block:: python
3016
3017 latex_domain_indices = {
3018 'py-modindex',
3019 }
3020
3021 .. versionadded:: 1.0
3022 .. versionchanged:: 7.4
3023 Permit and prefer a set type.
3024
3025 .. confval:: latex_show_pagerefs
3026 :type: :code-py:`bool`
3027 :default: :code-py:`False`
3028
3029 Add page references after internal references.
3030 This is very useful for printed copies of the manual.
3031
3032 .. versionadded:: 1.0
3033
3034 .. confval:: latex_show_urls
3035 :type: :code-py:`'no' | 'footnote' | 'inline'`
3036 :default: :code-py:`'no'`
3037
3038 Control how to display URL addresses.
3039 This is very useful for printed copies of the manual.
3040 The setting can have the following values:
3041
3042 :code-py:`'no'`
3043 Do not display URLs
3044 :code-py:`'footnote'`
3045 Display URLs in footnotes
3046 :code-py:`'inline'`
3047 Display URLs inline in parentheses
3048
3049 .. versionadded:: 1.0
3050 .. versionchanged:: 1.1
3051 This value is now a string; previously it was a boolean value,
3052 and a true value selected the :code-py:`'inline'` display.
3053 For backwards compatibility, :code-py:`True` is still accepted.
3054
3055 .. confval:: latex_use_latex_multicolumn
3056 :type: :code-py:`bool`
3057 :default: :code-py:`False`
3058
3059 Use standard LaTeX's :code-tex:`\\multicolumn` for merged cells in tables.
3060
3061 :code-py:`False`
3062 Sphinx's own macros are used for merged cells from grid tables.
3063 They allow general contents (literal blocks, lists, blockquotes, ...)
3064 but may have problems if the :rst:dir:`tabularcolumns` directive
3065 was used to inject LaTeX mark-up of the type
3066 ``>{..}``, ``<{..}``, ``@{..}`` as column specification.
3067 :code-py:`True`
3068 Use LaTeX's standard :code-tex:`\\multicolumn`;
3069 this is incompatible with literal blocks in horizontally merged cells,
3070 and also with multiple paragraphs in such cells
3071 if the table is rendered using ``tabulary``.
3072
3073 .. versionadded:: 1.6
3074
3075 .. confval:: latex_table_style
3076 :type: :code-py:`list[str]`
3077 :default: :code-py:`['booktabs', 'colorrows']`
3078
3079 A list of styling classes (strings).
3080 Currently supported:
3081
3082 :code-py:`'booktabs'`
3083 No vertical lines, and only 2 or 3 horizontal lines
3084 (the latter if there is a header),
3085 using the booktabs_ package.
3086
3087 :code-py:`'borderless'`
3088 No lines whatsoever.
3089
3090 :code-py:`'colorrows'`
3091 The table rows are rendered with alternating background colours.
3092 The interface to customise them is via
3093 :ref:`dedicated keys <tablecolors>` of :ref:`latexsphinxsetup`.
3094
3095 .. important::
3096
3097 With the :code-py:`'colorrows'` style,
3098 the :code-tex:`\\rowcolors` LaTeX command becomes a no-op
3099 (this command has limitations and has never correctly
3100 supported all types of tables Sphinx produces in LaTeX).
3101 Please use the
3102 :ref:`latex table color configuration <tablecolors>` keys instead.
3103
3104 To customise the styles for a table,
3105 use the ``:class:`` option if the table is defined using a directive,
3106 or otherwise insert a :ref:`rst-class <rstclass>` directive before the table
3107 (cf. :ref:`table-directives`).
3108
3109 Currently recognised classes are ``booktabs``, ``borderless``,
3110 ``standard``, ``colorrows``, ``nocolorrows``.
3111 The latter two can be combined with any of the first three.
3112 The ``standard`` class produces tables with
3113 both horizontal and vertical lines
3114 (as had been the default prior to Sphinx 6.0.0).
3115
3116 A single-row multi-column merged cell will obey the row colour,
3117 if it is set.
3118 See also ``TableMergeColor{Header,Odd,Even}``
3119 in the :ref:`latexsphinxsetup` section.
3120
3121 .. note::
3122
3123 * It is hard-coded in LaTeX that a single cell will obey the row colour
3124 even if there is a column colour set via :code-tex:`\\columncolor`
3125 from a column specification (see :rst:dir:`tabularcolumns`).
3126 Sphinx provides :code-tex:`\\sphinxnorowcolor` which can be used
3127 in a table column specification like this:
3128
3129 .. code-block:: latex
3130
3131 >{\columncolor{blue}\sphinxnorowcolor}
3132
3133 * Sphinx also provides :code-tex:`\\sphinxcolorblend`,
3134 which however requires the xcolor_ package.
3135 Here is an example:
3136
3137 .. code-block:: latex
3138
3139 >{\sphinxcolorblend{!95!red}}
3140
3141 It means that in this column,
3142 the row colours will be slightly tinted by red;
3143 refer to xcolor_ documentation for more on the syntax of its
3144 :code-tex:`\\blendcolors` command
3145 (a :code-tex:`\\blendcolors` in place of :code-tex:`\\sphinxcolorblend`
3146 would modify colours of the cell *contents*,
3147 not of the cell *background colour panel*...).
3148 You can find an example of usage in the :ref:`dev-deprecated-apis`
3149 section of this document in PDF format.
3150
3151 .. hint::
3152
3153 If you want to use a special colour for the *contents* of the
3154 cells of a given column use ``>{\noindent\color{<color>}}``,
3155 possibly in addition to the above.
3156
3157 * Multi-row merged cells, whether single column or multi-column
3158 currently ignore any set column, row, or cell colour.
3159
3160 * It is possible for a simple cell to set a custom colour via the
3161 :dudir:`raw` directive and
3162 the :code-tex:`\\cellcolor` LaTeX command used
3163 anywhere in the cell contents.
3164 This currently is without effect in a merged cell, whatever its kind.
3165
3166 .. hint::
3167
3168 In a document not using ``'booktabs'`` globally,
3169 it is possible to style an individual table via the ``booktabs`` class,
3170 but it will be necessary to add ``r'\usepackage{booktabs}'``
3171 to the LaTeX preamble.
3172
3173 On the other hand one can use ``colorrows`` class for individual tables
3174 with no extra package (as Sphinx since 5.3.0 always loads colortbl_).
3175
3176 .. _booktabs: https://ctan.org/pkg/booktabs
3177 .. _colortbl: https://ctan.org/pkg/colortbl
3178 .. _xcolor: https://ctan.org/pkg/xcolor
3179
3180 .. versionadded:: 5.3.0
3181
3182 .. versionchanged:: 6.0.0
3183
3184 Modify default from :code-py:`[]` to :code-py:`['booktabs', 'colorrows']`.
3185
3186 .. confval:: latex_use_xindy
3187 :type: :code-py:`bool`
3188 :default: :code-py:`True if latex_engine in {'xelatex', 'lualatex'} else False`
3189
3190 Use Xindy_ to prepare the index of general terms.
3191 By default, the LaTeX builder uses :program:`makeindex`
3192 for preparing the index of general terms .
3193 Using Xindy_ means that words with UTF-8 characters will be
3194 ordered correctly for the :confval:`language`.
3195
3196 .. _Xindy: https://xindy.sourceforge.net/
3197
3198 * This option is ignored if :confval:`latex_engine` is :code-py:`'platex'`
3199 (Japanese documents;
3200 :program:`mendex` replaces :program:`makeindex` then).
3201
3202 * The default is :code-py:`True`
3203 for :code-py:`'xelatex'` or :code-py:`'lualatex'` as
3204 :program:`makeindex` creates ``.ind`` files containing invalid bytes
3205 for the UTF-8 encoding if any indexed term starts with
3206 a non-ASCII character.
3207 With :code-py:`'lualatex'` this then breaks the PDF build.
3208
3209 * The default is :code-py:`False` for :code-py:`'pdflatex'`,
3210 but :code-py:`True` is recommended for non-English documents as soon
3211 as some indexed terms use non-ASCII characters from the language script.
3212 Attempting to index a term whose first character is non-ASCII
3213 will break the build, if :confval:`latex_use_xindy` is left to its
3214 default :code-py:`False`.
3215
3216 Sphinx adds some dedicated support to the :program:`xindy` base distribution
3217 for using :code-py:`'pdflatex'` engine with Cyrillic scripts.
3218 With both :code-py:`'pdflatex'` and Unicode engines,
3219 Cyrillic documents handle the indexing of Latin names correctly,
3220 even those having diacritics.
3221
3222 .. versionadded:: 1.8
3223
3224 .. confval:: latex_elements
3225 :type: :code-py:`dict[str, str]`
3226 :default: :code-py:`{}`
3227
3228 .. versionadded:: 0.5
3229
3230 :ref:`See the full documentation for latex_elements <latex_elements_confval>`.
3231
3232 .. confval:: latex_docclass
3233 :type: :code-py:`dict[str, str]`
3234 :default: :code-py:`{}`
3235
3236 A dictionary mapping :code-py:`'howto'` and :code-py:`'manual'`
3237 to names of real document classes that will be used as the base
3238 for the two Sphinx classes.
3239 Default is to use :code-py:`'article'` for :code-py:`'howto'`
3240 and :code-py:`'report'` for :code-py:`'manual'`.
3241
3242 .. versionadded:: 1.0
3243
3244 .. versionchanged:: 1.5
3245 In Japanese documentation (:confval:`language` is :code-py:`'ja'`),
3246 by default :code-py:`'jreport'` is used for :code-py:`'howto'`
3247 and :code-py:`'jsbook'` for :code-py:`'manual'`.
3248
3249 .. confval:: latex_additional_files
3250 :type: :code-py:`Sequence[str]`
3251 :default: :code-py:`()`
3252
3253 A list of file names, relative to the :term:`configuration directory`,
3254 to copy to the build directory when building LaTeX output.
3255 This is useful to copy files that Sphinx doesn't copy automatically,
3256 or to overwrite Sphinx LaTeX support files with custom versions.
3257 Image files that are referenced in source files (e.g. via ``.. image::``)
3258 are copied automatically and should not be listed there.
3259
3260 .. attention::
3261 Filenames with the ``.tex`` extension will be automatically
3262 handed over to the PDF build process triggered by
3263 :option:`sphinx-build -M latexpdf <sphinx-build -M>`
3264 or by :program:`make latexpdf`.
3265 If the file was added only to be :code-tex:`\\input{}`
3266 from a modified preamble,
3267 you must add a further suffix such as ``.txt`` to the filename
3268 and adjust the :code-tex:`\\input{}` macro accordingly.
3269
3270 .. versionadded:: 0.6
3271
3272 .. versionchanged:: 1.2
3273 This overrides the files provided from Sphinx such as ``sphinx.sty``.
3274
3275 .. confval:: latex_theme
3276 :type: :code-py:`str`
3277 :default: :code-py:`'manual'`
3278
3279 The "theme" that the LaTeX output should use.
3280 It is a collection of settings for LaTeX output
3281 (e.g. document class, top level sectioning unit and so on).
3282
3283 The bundled first-party LaTeX themes are *manual* and *howto*:
3284
3285 ``manual``
3286 A LaTeX theme for writing a manual.
3287 It imports the ``report`` document class
3288 (Japanese documents use ``jsbook``).
3289
3290 ``howto``
3291 A LaTeX theme for writing an article.
3292 It imports the ``article`` document class
3293 (Japanese documents use ``jreport``).
3294 :confval:`latex_appendices` is only available for this theme.
3295
3296 .. versionadded:: 3.0
3297
3298 .. confval:: latex_theme_options
3299 :type: :code-py:`dict[str, Any]`
3300 :default: :code-py:`{}`
3301
3302 A dictionary of options that influence the
3303 look and feel of the selected theme.
3304 These are theme-specific.
3305
3306 .. versionadded:: 3.1
3307
3308 .. confval:: latex_theme_path
3309 :type: :code-py:`list[str]`
3310 :default: :code-py:`[]`
3311
3312 A list of paths that contain custom LaTeX themes as subdirectories.
3313 Relative paths are taken as relative to the :term:`configuration directory`.
3314
3315 .. versionadded:: 3.0
3316
3317
3318 .. _text-options:
3319
3320 Options for text output
3321 -----------------------
3322
3323 These options influence text output.
3324
3325 .. confval:: text_add_secnumbers
3326 :type: :code-py:`bool`
3327 :default: :code-py:`True`
3328
3329 Include section numbers in text output.
3330
3331 .. versionadded:: 1.7
3332
3333 .. confval:: text_newlines
3334 :type: :code-py:`'unix' | 'windows' | 'native'`
3335 :default: :code-py:`'unix'`
3336
3337 Determines which end-of-line character(s) are used in text output.
3338
3339 :code-py:`'unix'`
3340 Use Unix-style line endings (``\n``).
3341 :code-py:`'windows'`
3342 Use Windows-style line endings (``\r\n``).
3343 :code-py:`'native'`
3344 Use the line ending style of the platform the documentation is built on.
3345
3346 .. versionadded:: 1.1
3347
3348 .. confval:: text_secnumber_suffix
3349 :type: :code-py:`str`
3350 :default: :code-py:`'. '`
3351
3352 Suffix for section numbers in text output.
3353 Set to :code-py:`' '` to suppress the final dot on section numbers.
3354
3355 .. versionadded:: 1.7
3356
3357 .. confval:: text_sectionchars
3358 :type: :code-py:`str`
3359 :default: :code-py:`'*=-~"+\`'`
3360
3361 A string of 7 characters that should be used for underlining sections.
3362 The first character is used for first-level headings,
3363 the second for second-level headings and so on.
3364
3365 .. versionadded:: 1.1
3366
3367
3368 .. _man-options:
3369
3370 Options for manual page output
3371 ------------------------------
3372
3373 These options influence manual page output.
3374
3375 .. confval:: man_pages
3376 :type: :code-py:`Sequence[tuple[str, str, str, str, str]]`
3377 :default: The default manual pages
3378
3379 This value determines how to group the document tree
3380 into manual pages.
3381 It must be a list of tuples
3382 ``(startdocname, name, description, authors, section)``,
3383 where the items are:
3384
3385 *startdocname*
3386 String that specifies the :term:`document name` of
3387 the manual page's master document.
3388 All documents referenced by the *startdoc* document in
3389 ToC trees will be included in the manual page.
3390 (If you want to use the default master document for your manual pages build,
3391 provide your :confval:`master_doc` here.)
3392
3393 *name*
3394 Name of the manual page.
3395 This should be a short string without spaces or special characters.
3396 It is used to determine the file name as well as the
3397 name of the manual page (in the NAME section).
3398
3399 *description*
3400 Description of the manual page.
3401 This is used in the NAME section.
3402 Can be an empty string if you do not want to
3403 automatically generate the NAME section.
3404
3405 *authors*
3406 A list of strings with authors, or a single string.
3407 Can be an empty string or list if you do not want to
3408 automatically generate an AUTHORS section in the manual page.
3409
3410 *section*
3411 The manual page section.
3412 Used for the output file name as well as in the manual page header.
3413
3414 .. versionadded:: 1.0
3415
3416 .. confval:: man_show_urls
3417 :type: :code-py:`bool`
3418 :default: :code-py:`False`
3419
3420 Add URL addresses after links.
3421
3422 .. versionadded:: 1.1
3423
3424 .. confval:: man_make_section_directory
3425 :type: :code-py:`bool`
3426 :default: :code-py:`True`
3427
3428 Make a section directory on build man page.
3429
3430 .. versionadded:: 3.3
3431
3432 .. versionchanged:: 4.0
3433 The default is now :code-py:`False` (previously :code-py:`True`).
3434
3435 .. versionchanged:: 4.0.2
3436 Revert the change in the default.
3437
3438
3439 .. _texinfo-options:
3440
3441 Options for Texinfo output
3442 --------------------------
3443
3444 These options influence Texinfo output.
3445
3446 .. confval:: texinfo_documents
3447 :type: :code-py:`Sequence[tuple[str, str, str, str, str, str, str, bool]]`
3448 :default: The default Texinfo documents
3449
3450 This value determines how to group the document tree
3451 into Texinfo source files.
3452 It must be a list of tuples ``(startdocname, targetname, title, author,
3453 dir_entry, description, category, toctree_only)``,
3454 where the items are:
3455
3456 *startdocname*
3457 String that specifies the :term:`document name` of
3458 the Texinfo file's master document.
3459 All documents referenced by the *startdoc* document in
3460 ToC trees will be included in the Texinfo file.
3461 (If you want to use the default master document for your Texinfo build,
3462 provide your :confval:`master_doc` here.)
3463
3464 *targetname*
3465 File name (no extension) of the Texinfo file in the output directory.
3466
3467 *title*
3468 Texinfo document title.
3469 Can be empty to use the title of the *startdoc*
3470 document. Inserted as Texinfo markup,
3471 so special characters like ``@`` and ``{}`` will need to
3472 be escaped to be inserted literally.
3473
3474 *author*
3475 Author for the Texinfo document.
3476 Inserted as Texinfo markup.
3477 Use ``@*`` to separate multiple authors, as in: ``'John@*Sarah'``.
3478
3479 *dir_entry*
3480 The name that will appear in the top-level ``DIR`` menu file.
3481
3482 *description*
3483 Descriptive text to appear in the top-level ``DIR`` menu file.
3484
3485 *category*
3486 Specifies the section which this entry will appear in the top-level
3487 ``DIR`` menu file.
3488
3489 *toctree_only*
3490 Must be :code-py:`True` or :code-py:`False`.
3491 If True, the *startdoc* document itself is not included in the output,
3492 only the documents referenced by it via ToC trees.
3493 With this option, you can put extra stuff in the master document
3494 that shows up in the HTML, but not the Texinfo output.
3495
3496 .. versionadded:: 1.1
3497
3498 .. confval:: texinfo_appendices
3499 :type: :code-py:`Sequence[str]`
3500 :default: :code-py:`[]`
3501
3502 A list of document names to append as an appendix to all manuals.
3503
3504 .. versionadded:: 1.1
3505
3506 .. confval:: texinfo_cross_references
3507 :type: :code-py:`bool`
3508 :default: :code-py:`True`
3509
3510 Generate inline references in a document.
3511 Disabling inline references can make an info file more readable
3512 with a stand-alone reader (``info``).
3513
3514 .. versionadded:: 4.4
3515
3516 .. confval:: texinfo_domain_indices
3517 :type: :code-py:`bool | Sequence[str]`
3518 :default: :code-py:`True`
3519
3520 If True, generate domain-specific indices in addition to the general index.
3521 For e.g. the Python domain, this is the global module index.
3522
3523 This value can be a Boolean or a list of index names that should be generated.
3524 To find out the index name for a specific index, look at the HTML file name.
3525 For example, the Python module index has the name ``'py-modindex'``.
3526
3527 Example:
3528
3529 .. code-block:: python
3530
3531 texinfo_domain_indices = {
3532 'py-modindex',
3533 }
3534
3535 .. versionadded:: 1.1
3536 .. versionchanged:: 7.4
3537 Permit and prefer a set type.
3538
3539 .. confval:: texinfo_elements
3540 :type: :code-py:`dict[str, Any]`
3541 :default: :code-py:`{}`
3542
3543 A dictionary that contains Texinfo snippets that override those that
3544 Sphinx usually puts into the generated ``.texi`` files.
3545
3546 * Keys that you may want to override include:
3547
3548 ``'paragraphindent'``
3549 Number of spaces to indent the first line of each paragraph,
3550 default ``2``.
3551 Specify ``0`` for no indentation.
3552
3553 ``'exampleindent'``
3554 Number of spaces to indent the lines for examples or literal blocks,
3555 default ``4``.
3556 Specify ``0`` for no indentation.
3557
3558 ``'preamble'``
3559 Texinfo markup inserted near the beginning of the file.
3560
3561 ``'copying'``
3562 Texinfo markup inserted within the ``@copying`` block
3563 and displayed after the title.
3564 The default value consists of a simple title page identifying the project.
3565
3566 * Keys that are set by other options
3567 and therefore should not be overridden are
3568 ``'author'``, ``'body'``, ``'date'``, ``'direntry'``
3569 ``'filename'``, ``'project'``, ``'release'``, and ``'title'``.
3570
3571 .. versionadded:: 1.1
3572
3573 .. confval:: texinfo_no_detailmenu
3574 :type: :code-py:`bool`
3575 :default: :code-py:`False`
3576
3577 Do not generate a ``@detailmenu`` in the "Top" node's menu
3578 containing entries for each sub-node in the document.
3579
3580 .. versionadded:: 1.2
3581
3582 .. confval:: texinfo_show_urls
3583 :type: :code-py:`'footnote' | 'no' | 'inline'`
3584 :default: :code-py:`'footnote'`
3585
3586 Control how to display URL addresses.
3587 The setting can have the following values:
3588
3589 :code-py:`'footnote'`
3590 Display URLs in footnotes.
3591 :code-py:`'no'`
3592 Do not display URLs.
3593 :code-py:`'inline'`
3594 Display URLs inline in parentheses.
3595
3596 .. versionadded:: 1.1
3597
3598
3599 .. _qthelp-options:
3600
3601 Options for QtHelp output
3602 --------------------------
3603
3604 These options influence qthelp output.
3605 This builder derives from the HTML builder,
3606 so the HTML options also apply where appropriate.
3607
3608 .. confval:: qthelp_basename
3609 :type: :code-py:`str`
3610 :default: The value of **project**
3611
3612 The basename for the qthelp file.
3613
3614 .. confval:: qthelp_namespace
3615 :type: :code-py:`str`
3616 :default: :code-py:`'org.sphinx.{project_name}.{project_version}'`
3617
3618 The namespace for the qthelp file.
3619
3620 .. confval:: qthelp_theme
3621 :type: :code-py:`str`
3622 :default: :code-py:`'nonav'`
3623
3624 The HTML theme for the qthelp output.
3625
3626 .. confval:: qthelp_theme_options
3627 :type: :code-py:`dict[str, Any]`
3628 :default: :code-py:`{}`
3629
3630 A dictionary of options that influence the
3631 look and feel of the selected theme.
3632 These are theme-specific.
3633 The options understood by the :ref:`builtin themes
3634 <builtin-themes>` are described :ref:`here <builtin-themes>`.
3635
3636
3637 Options for XML output
3638 ----------------------
3639
3640 .. confval:: xml_pretty
3641 :type: :code-py:`bool`
3642 :default: :code-py:`True`
3643
3644 Pretty-print the XML.
3645
3646 .. versionadded:: 1.2
3647
3648
3649 Options for the linkcheck builder
3650 ---------------------------------
3651
3652 Filtering
3653 ~~~~~~~~~
3654
3655 These options control which links the *linkcheck* builder checks,
3656 and which failures and redirects it ignores.
3657
3658 .. confval:: linkcheck_allowed_redirects
3659 :type: :code-py:`dict[str, str]`
3660
3661 A dictionary that maps a pattern of the source URI
3662 to a pattern of the canonical URI.
3663 The *linkcheck* builder treats the redirected link as "working" when:
3664
3665 * the link in the document matches the source URI pattern, and
3666 * the redirect location matches the canonical URI pattern.
3667
3668 The *linkcheck* builder will emit a warning when
3669 it finds redirected links that don't meet the rules above.
3670 It can be useful to detect unexpected redirects when using
3671 :option:`the fail-on-warnings mode <sphinx-build --fail-on-warning>`.
3672
3673 Example:
3674
3675 .. code-block:: python
3676
3677 linkcheck_allowed_redirects = {
3678 # All HTTP redirections from the source URI to
3679 # the canonical URI will be treated as "working".
3680 r'https://sphinx-doc\.org/.*': r'https://sphinx-doc\.org/en/master/.*'
3681 }
3682
3683 .. versionadded:: 4.1
3684
3685 .. versionchanged:: 9.0
3686 Setting :confval:`!linkcheck_allowed_redirects` to an empty dictionary
3687 may now be used to warn on all redirects encountered
3688 by the *linkcheck* builder.
3689
3690 .. confval:: linkcheck_anchors
3691 :type: :code-py:`bool`
3692 :default: :code-py:`True`
3693
3694 Check the validity of ``#anchor``\ s in links.
3695 Since this requires downloading the whole document,
3696 it is considerably slower when enabled.
3697
3698 .. versionadded:: 1.2
3699
3700 .. confval:: linkcheck_anchors_ignore
3701 :type: :code-py:`Sequence[str]`
3702 :default: :code-py:`["^!"]`
3703
3704 A list of regular expressions that match anchors that the *linkcheck* builder
3705 should skip when checking the validity of anchors in links.
3706 For example, this allows skipping anchors added by a website's JavaScript.
3707
3708 .. tip::
3709 Use :confval:`linkcheck_anchors_ignore_for_url` to check a URL,
3710 but skip verifying that the anchors exist.
3711
3712 .. note::
3713 If you want to ignore anchors of a specific page or
3714 of pages that match a specific pattern
3715 (but still check occurrences of the same page(s) that don't have anchors),
3716 use :confval:`linkcheck_ignore` instead,
3717 for example as follows:
3718
3719 .. code-block:: python
3720
3721 linkcheck_ignore = [
3722 'https://www.sphinx-doc.org/en/1.7/intro.html#',
3723 ]
3724
3725 .. versionadded:: 1.5
3726
3727 .. confval:: linkcheck_anchors_ignore_for_url
3728 :type: :code-py:`Sequence[str]`
3729 :default: :code-py:`()`
3730
3731 A list or tuple of regular expressions matching URLs
3732 for which the *linkcheck* builder should not check the validity of anchors.
3733 This allows skipping anchor checks on a per-page basis
3734 while still checking the validity of the page itself.
3735
3736 .. versionadded:: 7.1
3737
3738 .. confval:: linkcheck_exclude_documents
3739 :type: :code-py:`Sequence[str]`
3740 :default: :code-py:`()`
3741
3742 A list of regular expressions that match documents in which
3743 the *linkcheck* builder should not check the validity of links.
3744 This can be used for permitting link decay
3745 in legacy or historical sections of the documentation.
3746
3747 Example:
3748
3749 .. code-block:: python
3750
3751 # ignore all links in documents located in a subdirectory named 'legacy'
3752 linkcheck_exclude_documents = [r'.*/legacy/.*']
3753
3754 .. versionadded:: 4.4
3755
3756 .. confval:: linkcheck_ignore
3757 :type: :code-py:`Sequence[str]`
3758 :default: :code-py:`()`
3759
3760 A list of regular expressions that match URIs that should not be checked
3761 when doing a ``linkcheck`` build.
3762
3763 Server-issued redirects that match :confval:`ignored URIs <linkcheck_ignore>`
3764 will not be followed.
3765
3766 Example:
3767
3768 .. code-block:: python
3769
3770 linkcheck_ignore = [r'https://localhost:\d+/']
3771
3772 .. versionadded:: 1.1
3773
3774 HTTP Requests
3775 ~~~~~~~~~~~~~
3776
3777 These options control how the *linkcheck* builder makes HTTP requests,
3778 including how it handles redirects and authentication,
3779 and the number of workers to use.
3780
3781 .. confval:: linkcheck_auth
3782 :type: :code-py:`Sequence[tuple[str, Any]]`
3783 :default: :code-py:`[]`
3784
3785 Pass authentication information when doing a ``linkcheck`` build.
3786
3787 A list of :code-py:`(regex_pattern, auth_info)` tuples where the items are:
3788
3789 *regex_pattern*
3790 A regular expression that matches a URI.
3791 *auth_info*
3792 Authentication information to use for that URI.
3793 The value can be anything that is understood by the ``requests`` library
3794 (see :ref:`requests authentication <requests:authentication>` for details).
3795
3796 The *linkcheck* builder will use the first matching ``auth_info`` value
3797 it can find in the :confval:`!linkcheck_auth` list,
3798 so values earlier in the list have higher priority.
3799
3800 Example:
3801
3802 .. code-block:: python
3803
3804 linkcheck_auth = [
3805 ('https://foo\.yourcompany\.com/.+', ('johndoe', 'secret')),
3806 ('https://.+\.yourcompany\.com/.+', HTTPDigestAuth(...)),
3807 ]
3808
3809 .. versionadded:: 2.3
3810
3811 .. confval:: linkcheck_allow_unauthorized
3812 :type: :code-py:`bool`
3813 :default: :code-py:`False`
3814
3815 When a webserver responds with an HTTP 401 (unauthorised) response,
3816 the current default behaviour of the *linkcheck* builder is
3817 to treat the link as "broken".
3818 To change that behaviour, set this option to :code-py:`True`.
3819
3820 .. versionchanged:: 8.0
3821 The default value for this option changed to :code-py:`False`,
3822 meaning HTTP 401 responses to checked hyperlinks
3823 are treated as "broken" by default.
3824
3825 .. versionadded:: 7.3
3826
3827 .. confval:: linkcheck_case_insensitive_urls
3828 :type: :code-py:`Set[str] | Sequence[str]`
3829 :default: :code-py:`()`
3830
3831 A collection of regular expressions that match URLs for which the *linkcheck*
3832 builder should perform case-insensitive comparisons. This is useful for
3833 links to websites that are case-insensitive or normalise URL casing.
3834
3835 By default, *linkcheck* requires the destination URL to match the
3836 documented URL case-sensitively.
3837 For example, a link to ``http://example.org/PATH`` that redirects to
3838 ``http://example.org/path`` will be reported as ``redirected``.
3839
3840 If the URL matches a pattern contained in
3841 :confval:`!linkcheck_case_insensitive_urls`,
3842 it would instead be reported as ``working``.
3843
3844 For example, to treat all GitHub URLs as case-insensitive:
3845
3846 .. code-block:: python
3847
3848 linkcheck_case_insensitive_urls = [
3849 r'https://github\.com/.*',
3850 ]
3851
3852 Or, to treat all URLs as case-insensitive:
3853
3854 .. code-block:: python
3855
3856 linkcheck_case_insensitive_urls = ['.*']
3857
3858 .. note:: URI fragments (HTML anchors) are not affected by this option.
3859 They are always checked with case-sensitive comparisons.
3860
3861 .. versionadded:: 9.0
3862
3863 .. confval:: linkcheck_rate_limit_timeout
3864 :type: :code-py:`int`
3865 :default: :code-py:`300`
3866
3867 The *linkcheck* builder may issue a large number of requests to the same
3868 site over a short period of time.
3869 This setting controls the builder behaviour
3870 when servers indicate that requests are rate-limited,
3871 by setting the maximum duration (in seconds) that the builder will
3872 wait for between each attempt before recording a failure.
3873
3874 The *linkcheck* builder always respects a server's direction
3875 of when to retry (using the `Retry-After`_ header).
3876 Otherwise, ``linkcheck`` waits for a minute before to retry and keeps
3877 doubling the wait time between attempts until it succeeds or exceeds the
3878 :confval:`!linkcheck_rate_limit_timeout` (in seconds).
3879 Custom timeouts should be given as a number of seconds.
3880
3881 .. _Retry-After: https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3
3882
3883 .. versionadded:: 3.4
3884
3885 .. confval:: linkcheck_report_timeouts_as_broken
3886 :type: :code-py:`bool`
3887 :default: :code-py:`False`
3888
3889 If :confval:`linkcheck_timeout` expires while waiting for a response from
3890 a hyperlink, the *linkcheck* builder will report the link as a ``timeout``
3891 by default. To report timeouts as ``broken`` instead, you can
3892 set :confval:`linkcheck_report_timeouts_as_broken` to :code-py:`True`.
3893
3894 .. versionchanged:: 8.0
3895 The default value for this option changed to :code-py:`False`,
3896 meaning timeouts that occur while checking hyperlinks
3897 will be reported using the new 'timeout' status code.
3898
3899 .. versionadded:: 7.3
3900
3901 .. confval:: linkcheck_request_headers
3902 :type: :code-py:`dict[str, dict[str, str]]`
3903 :default: :code-py:`{}`
3904
3905 A dictionary that maps URL (without paths) to HTTP request headers.
3906
3907 The key is a URL base string like :code-py:`'https://www.sphinx-doc.org/'`.
3908 To specify headers for other hosts, :code-py:`"*"` can be used.
3909 It matches all hosts only when the URL does not match other settings.
3910
3911 The value is a dictionary that maps header name to its value.
3912
3913 Example:
3914
3915 .. code-block:: python
3916
3917 linkcheck_request_headers = {
3918 "https://www.sphinx-doc.org/": {
3919 "Accept": "text/html",
3920 "Accept-Encoding": "utf-8",
3921 },
3922 "*": {
3923 "Accept": "text/html,application/xhtml+xml",
3924 }
3925 }
3926
3927 .. versionadded:: 3.1
3928
3929 .. confval:: linkcheck_retries
3930 :type: :code-py:`int`
3931 :default: :code-py:`1`
3932
3933 The number of times the *linkcheck* builder
3934 will attempt to check a URL before declaring it broken.
3935
3936 .. versionadded:: 1.4
3937
3938 .. confval:: linkcheck_timeout
3939 :type: :code-py:`int`
3940 :default: :code-py:`30`
3941
3942 The duration, in seconds, that the *linkcheck* builder
3943 will wait for a response after each hyperlink request.
3944
3945 .. versionadded:: 1.1
3946
3947 .. confval:: linkcheck_workers
3948 :type: :code-py:`int`
3949 :default: :code-py:`5`
3950
3951 The number of worker threads to use when checking links.
3952
3953 .. versionadded:: 1.1
3954
3955
3956 Domain options
3957 ==============
3958
3959
3960 .. _c-config:
3961
3962 Options for the C domain
3963 ------------------------
3964
3965 .. confval:: c_extra_keywords
3966 :type: :code-py:`Set[str] | Sequence[str]`
3967 :default: :code-py:`['alignas', 'alignof', 'bool',
3968 'complex', 'imaginary', 'noreturn',
3969 'static_assert', 'thread_local']`
3970
3971 A list of identifiers to be recognised as keywords by the C parser.
3972
3973 .. versionadded:: 4.0.3
3974 .. versionchanged:: 7.4
3975 :confval:`!c_extra_keywords` can now be a set.
3976
3977 .. confval:: c_id_attributes
3978 :type: :code-py:`Sequence[str]`
3979 :default: :code-py:`()`
3980
3981 A sequence of strings that the parser should additionally accept
3982 as attributes.
3983 For example, this can be used when :code-c:`#define`
3984 has been used for attributes, for portability.
3985
3986 Example:
3987
3988 .. code-block:: python
3989
3990 c_id_attributes = [
3991 'my_id_attribute',
3992 ]
3993
3994 .. versionadded:: 3.0
3995 .. versionchanged:: 7.4
3996 :confval:`!c_id_attributes` can now be a tuple.
3997
3998 .. confval:: c_maximum_signature_line_length
3999 :type: :code-py:`int | None`
4000 :default: :code-py:`None`
4001
4002 If a signature's length in characters exceeds the number set,
4003 each parameter within the signature will be displayed on
4004 an individual logical line.
4005
4006 When :code-py:`None`, there is no maximum length and the entire
4007 signature will be displayed on a single logical line.
4008
4009 This is a domain-specific setting,
4010 overriding :confval:`maximum_signature_line_length`.
4011
4012 .. versionadded:: 7.1
4013
4014 .. confval:: c_paren_attributes
4015 :type: :code-py:`Sequence[str]`
4016 :default: :code-py:`()`
4017
4018 A sequence of strings that the parser should additionally accept
4019 as attributes with one argument.
4020 That is, if ``my_align_as`` is in the list,
4021 then :code-c:`my_align_as(X)` is parsed as an attribute
4022 for all strings ``X`` that have balanced braces
4023 (:code-c:`()`, :code-c:`[]`, and :code-c:`{}`).
4024 For example, this can be used when :code-c:`#define`
4025 has been used for attributes, for portability.
4026
4027 Example:
4028
4029 .. code-block:: python
4030
4031 c_paren_attributes = [
4032 'my_align_as',
4033 ]
4034
4035 .. versionadded:: 3.0
4036 .. versionchanged:: 7.4
4037 :confval:`!c_paren_attributes` can now be a tuple.
4038
4039
4040 .. _cpp-config:
4041
4042 Options for the C++ domain
4043 --------------------------
4044
4045 .. confval:: cpp_id_attributes
4046 :type: :code-py:`Sequence[str]`
4047 :default: :code-py:`()`
4048
4049 A sequence of strings that the parser should additionally accept
4050 as attributes.
4051 For example, this can be used when :code-cpp:`#define`
4052 has been used for attributes, for portability.
4053
4054 Example:
4055
4056 .. code-block:: python
4057
4058 cpp_id_attributes = [
4059 'my_id_attribute',
4060 ]
4061
4062 .. versionadded:: 1.5
4063 .. versionchanged:: 7.4
4064 :confval:`!cpp_id_attributes` can now be a tuple.
4065
4066 .. confval:: cpp_index_common_prefix
4067 :type: :code-py:`Sequence[str]`
4068 :default: :code-py:`()`
4069
4070 A list of prefixes that will be ignored
4071 when sorting C++ objects in the global index.
4072
4073 Example:
4074
4075 .. code-block:: python
4076
4077 cpp_index_common_prefix = [
4078 'awesome_lib::',
4079 ]
4080
4081 .. versionadded:: 1.5
4082
4083 .. confval:: cpp_maximum_signature_line_length
4084 :type: :code-py:`int | None`
4085 :default: :code-py:`None`
4086
4087 If a signature's length in characters exceeds the number set,
4088 each parameter within the signature will be displayed on
4089 an individual logical line.
4090
4091 When :code-py:`None`, there is no maximum length and the entire
4092 signature will be displayed on a single logical line.
4093
4094 This is a domain-specific setting,
4095 overriding :confval:`maximum_signature_line_length`.
4096
4097 .. versionadded:: 7.1
4098
4099 .. confval:: cpp_paren_attributes
4100 :type: :code-py:`Sequence[str]`
4101 :default: :code-py:`()`
4102
4103 A sequence of strings that the parser should additionally accept
4104 as attributes with one argument.
4105 That is, if ``my_align_as`` is in the list,
4106 then :code-cpp:`my_align_as(X)` is parsed as an attribute
4107 for all strings ``X`` that have balanced braces
4108 (:code-cpp:`()`, :code-cpp:`[]`, and :code-cpp:`{}`).
4109 For example, this can be used when :code-cpp:`#define`
4110 has been used for attributes, for portability.
4111
4112 Example:
4113
4114 .. code-block:: python
4115
4116 cpp_paren_attributes = [
4117 'my_align_as',
4118 ]
4119
4120 .. versionadded:: 1.5
4121 .. versionchanged:: 7.4
4122 :confval:`!cpp_paren_attributes` can now be a tuple.
4123
4124
4125 Options for the Javascript domain
4126 ---------------------------------
4127
4128 .. confval:: javascript_maximum_signature_line_length
4129 :type: :code-py:`int | None`
4130 :default: :code-py:`None`
4131
4132 If a signature's length in characters exceeds the number set,
4133 each parameter within the signature will be displayed on
4134 an individual logical line.
4135
4136 When :code-py:`None`, there is no maximum length and the entire
4137 signature will be displayed on a single logical line.
4138
4139 This is a domain-specific setting,
4140 overriding :confval:`maximum_signature_line_length`.
4141
4142 .. versionadded:: 7.1
4143
4144 .. confval:: javascript_trailing_comma_in_multi_line_signatures
4145 :type: :code-py:`bool`
4146 :default: :code-py:`True`
4147
4148 Use a trailing comma in parameter lists spanning multiple lines, if true.
4149
4150 .. versionadded:: 8.2
4151
4152
4153 Options for the Python domain
4154 -----------------------------
4155
4156 .. confval:: add_module_names
4157 :type: :code-py:`bool`
4158 :default: :code-py:`True`
4159
4160 A boolean that decides whether module names are prepended
4161 to all :term:`object` names
4162 (for object types where a "module" of some kind is defined),
4163 e.g. for :rst:dir:`py:function` directives.
4164
4165 .. confval:: modindex_common_prefix
4166 :type: :code-py:`list[str]`
4167 :default: :code-py:`[]`
4168
4169 A list of prefixes that are ignored for sorting the Python module index
4170 (e.g., if this is set to :code-py:`['foo.']`,
4171 then ``foo.bar`` is shown under ``B``, not ``F``).
4172 This can be handy if you document a project that consists of a
4173 single package.
4174
4175 .. caution::
4176 Works only for the HTML builder currently.
4177
4178 .. versionadded:: 0.6
4179
4180 .. confval:: python_display_short_literal_types
4181 :type: :code-py:`bool`
4182 :default: :code-py:`False`
4183
4184 This value controls how :py:data:`~typing.Literal` types are displayed.
4185
4186 Examples
4187 ~~~~~~~~
4188
4189 The examples below use the following :rst:dir:`py:function` directive:
4190
4191 .. code-block:: rst
4192
4193 .. py:function:: serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
4194
4195 When :code-py:`False`, :py:data:`~typing.Literal` types display as per standard
4196 Python syntax, i.e.:
4197
4198 .. code-block:: python
4199
4200 serve_food(item: Literal["egg", "spam", "lobster thermidor"]) -> None
4201
4202 When :code-py:`True`, :py:data:`~typing.Literal` types display with a short,
4203 :PEP:`604`-inspired syntax, i.e.:
4204
4205 .. code-block:: python
4206
4207 serve_food(item: "egg" | "spam" | "lobster thermidor") -> None
4208
4209 .. versionadded:: 6.2
4210
4211 .. confval:: python_maximum_signature_line_length
4212 :type: :code-py:`int | None`
4213 :default: :code-py:`None`
4214
4215 If a signature's length in characters exceeds the number set,
4216 each parameter within the signature will be displayed on
4217 an individual logical line.
4218
4219 When :code-py:`None`, there is no maximum length and the entire
4220 signature will be displayed on a single logical line.
4221
4222 This is a domain-specific setting,
4223 overriding :confval:`maximum_signature_line_length`.
4224
4225 For the Python domain, the signature length depends on whether
4226 the type parameters or the list of arguments are being formatted.
4227 For the former, the signature length ignores the length of the arguments list;
4228 for the latter, the signature length ignores the length of
4229 the type parameters list.
4230
4231 For instance, with :code-py:`python_maximum_signature_line_length = 20`,
4232 only the list of type parameters will be wrapped
4233 while the arguments list will be rendered on a single line
4234
4235 .. code-block:: rst
4236
4237 .. py:function:: add[T: VERY_LONG_SUPER_TYPE, U: VERY_LONG_SUPER_TYPE](a: T, b: U)
4238
4239 .. versionadded:: 7.1
4240
4241 .. confval:: python_trailing_comma_in_multi_line_signatures
4242 :type: :code-py:`bool`
4243 :default: :code-py:`True`
4244
4245 Use a trailing comma in parameter lists spanning multiple lines, if true.
4246
4247 .. versionadded:: 8.2
4248
4249 .. confval:: python_use_unqualified_type_names
4250 :type: :code-py:`bool`
4251 :default: :code-py:`False`
4252
4253 Suppress the module name of the python reference if it can be resolved.
4254
4255 .. versionadded:: 4.0
4256
4257 .. caution::
4258 This feature is experimental.
4259
4260 .. confval:: trim_doctest_flags
4261 :type: :code-py:`bool`
4262 :default: :code-py:`True`
4263
4264 Remove doctest flags (comments looking like :code-py:`# doctest: FLAG, ...`)
4265 at the ends of lines and ``<BLANKLINE>`` markers for all code
4266 blocks showing interactive Python sessions (i.e. doctests).
4267 See the extension :mod:`~sphinx.ext.doctest` for more
4268 possibilities of including doctests.
4269
4270 .. versionadded:: 1.0
4271 .. versionchanged:: 1.1
4272 Now also removes ``<BLANKLINE>``.
4273
4274
4275 Extension options
4276 =================
4277
4278 Extensions frequently have their own configuration options.
4279 Those for Sphinx's first-party extensions are documented
4280 in each :doc:`extension's page </usage/extensions/index>`.
4281
4282
4283 Example configuration file
4284 ==========================
4285
4286 .. code-block:: python
4287
4288 # -- Project information -----------------------------------------------------
4289 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
4290
4291 project = 'Test Project'
4292 copyright = '2000-2042, The Test Project Authors'
4293 author = 'The Authors'
4294 version = release = '4.16'
4295
4296 # -- General configuration ------------------------------------------------
4297 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
4298
4299 exclude_patterns = [
4300 '_build',
4301 'Thumbs.db',
4302 '.DS_Store',
4303 ]
4304 extensions = []
4305 language = 'en'
4306 master_doc = 'index'
4307 pygments_style = 'sphinx'
4308 source_suffix = '.rst'
4309 templates_path = ['_templates']
4310
4311 # -- Options for HTML output ----------------------------------------------
4312 # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
4313
4314 html_theme = 'alabaster'
4315 html_static_path = ['_static']