Debian Codegraph @

docs/user/config.rst

raw
1 .. include:: ../header.rst
2
3 ========================
4 Docutils Configuration
5 ========================
6
7 :Author: David Goodger
8 :Contact: [email protected]
9 :Revision: $Revision: 10337 $
10 :Date: $Date: 2026-05-22 12:32:28 +0200 (Fr, 22. Mai 2026) $
11 :Copyright: This document has been placed in the public domain.
12
13 .. sidebar:: Docutils Security for Web Applications
14
15 For a discussion about securing web applications, please see
16 `Deploying Docutils Securely <../howto/security.html>`_.
17
18 .. contents::
19
20 .. raw:: html
21
22 <style type="text/css"><!--
23 dl.field-list {--field-indent: 4.7em;}
24 --></style>
25
26
27 Introduction
28 ============
29
30 Settings priority
31 -----------------
32
33 Configuration file settings override the built-in defaults, and
34 command-line options override all.
35 Some settings override also an associated setting; [#override]_
36 others append values from the various sources. [#append-values]_
37
38 For the technicalities, see `Docutils Runtime Settings`_.
39
40
41 Configuration Files
42 -------------------
43
44 Configuration files are used for persistent customization;
45 they can be set once and take effect every time you use a component,
46 e.g., via a `front-end tool`_.
47
48 By default, Docutils checks the following places for configuration
49 files, in the following order:
50
51 1. ``/etc/docutils.conf``: This is a system-wide configuration file,
52 applicable to all Docutils processing on the system.
53
54 2. ``./docutils.conf``: This is a project-specific configuration file,
55 located in the current directory.
56 The Docutils front end has to be executed from the directory
57 containing this configuration file for it to take effect (note that
58 this directory may differ from the location of the source files).
59
60 3. ``~/.docutils``: This is a user-specific configuration file,
61 located in the user's home directory.
62
63 If more than one configuration file is found, all will be read and
64 **later entries** will **override earlier ones**. [#append-values]_
65 For example, a "stylesheet" entry in a user-specific configuration file
66 will override a "stylesheet" entry in the system-wide file.
67
68 .. _DOCUTILSCONFIG:
69
70 The default implicit config file paths can be overridden by the
71 ``DOCUTILSCONFIG`` environment variable. ``DOCUTILSCONFIG`` should
72 contain a colon-separated (semicolon-separated on Windows) sequence of
73 config file paths to search for; leave it empty to disable implicit
74 config files altogether. Tilde-expansion is performed on paths.
75 Paths are interpreted relative to the current working directory.
76 Empty path items are ignored.
77
78 .. |config| replace:: ``--config``
79
80 In addition, configuration files may be explicitly specified with the
81 |config|_ command-line option. These configuration files are read after
82 the three implicit ones listed above (or the ones defined by the
83 ``DOCUTILSCONFIG`` environment variable), and its entries will have
84 priority.
85
86
87 Configuration File Syntax
88 -------------------------
89
90 Configuration files are UTF-8-encoded text files. The configparser_
91 module from Python_'s standard library is used to read them.
92 From its documentation__:
93
94
95 A configuration file consists of sections, each led by a ``[section]``
96 header, followed by key/value entries separated by a specific string
97 (``=`` or ``:`` by default).
98 […] Leading and trailing whitespace is removed from keys and values.
99 […] Configuration files may include comments, prefixed by specific
100 characters (``#`` and ``;`` by default).
101
102 .. _configparser: https://docs.python.org/3/library/configparser.html
103 __ https://docs.python.org/3/library/configparser.html
104 #supported-ini-file-structure
105
106 The following conventions apply to Docutils configuration files:
107
108 * Configuration file **entry names** correspond to internal `runtime
109 settings`_. Underscores ("_") and hyphens ("-") can be used interchangeably
110 in entry names; hyphens are automatically converted to underscores.
111 Entries with non-applicable or misspelled entry names are silently ignored.
112
113 .. _boolean:
114
115 * For **boolean** settings (switches), the following values are
116 recognized (case-independent):
117
118 :True: "true", "yes", "on", "1"
119 :False: "false", "no", "off", "0", "" (no value)
120
121 .. _comma-separated:
122
123 * **Lists** are specified either comma- or _`colon-separated`:
124
125 *comma-separated*:
126 strip_classes_, strip_elements_with_classes_, smartquotes_locales_,
127 stylesheet_, stylesheet_dirs_, stylesheet_path_, use_bibtex_
128
129 Whitespace around list values is stripped, so you can write, e.g., ::
130
131 strip-classes: ham,eggs,
132 strip-elements-with-classes: sugar, salt, flour
133 stylesheet: html4css1.css,
134 math.css,
135 style sheet with spaces.css
136
137
138 *colon-separated*:
139 ignore_, prune_, sources_, expose_internals_
140
141 Whitespace around the delimiter is not stripped. Write, e.g., ::
142
143 expose_internals: source:line
144
145 * No `format string interpolation`__ is done.
146
147 __ https://docs.python.org/3/library/configparser.html#interpolation-of-values
148
149
150 Example
151 ~~~~~~~
152
153 This is from the ``tools/docutils.conf`` configuration file supplied
154 with Docutils::
155
156 # These entries affect all processing:
157 [general]
158 source-link: yes
159 datestamp: %Y-%m-%d %H:%M UTC
160 generator: on
161
162 # These entries affect HTML output:
163 [html writers]
164 embed-stylesheet: no
165
166 [html4css1 writer]
167 stylesheet-path: docutils/writers/html4css1/html4css1.css
168 field-name-limit: 20
169
170 [html5 writer]
171 stylesheet-dirs: docutils/writers/html5_polyglot/
172 stylesheet-path: minimal.css, responsive.css
173
174
175 .. _configuration section:
176 .. _configuration sections:
177
178 Configuration File Sections & Entries
179 -------------------------------------
180
181 Below are the Docutils runtime settings, listed by config file section.
182 Sections correspond to Docutils components (module name or alias; always
183 in lowercase letters).
184
185 .. important:: Any setting may be specified in any section, but only
186 settings from "`active sections`_" will be used.
187
188
189 .. _active sections:
190
191 Each Docutils application_ uses a specific set of components;
192 `corresponding configuration file sections`__ are "active" when the
193 application is used.
194
195 Configuration sections are applied in general-to-specific order:
196
197 1. `[general]`_
198
199 2. `[parsers]`_, parser dependencies, and the section specific to the
200 Parser used ("[... parser]").
201
202 3. `[readers]`_, reader dependencies, and the section specific to the
203 Reader used ("[... reader]"). For example, `[pep reader]`_ depends
204 on `[standalone reader]`_.
205
206 4. `[writers]`_, writer family ("[... writers]"; if applicable),
207 writer dependencies, and the section specific to the writer used
208 ("[... writer]"). For example, `[pep_html writer]`_ depends
209 on `[html writers]`_ and `[html4css1 writer]`_.
210
211 5. `[applications]`_, application dependencies, and the section
212 specific to the Application (`front-end tool`_) in use
213 ("[... application]").
214
215 Since any setting may be specified in any section, this ordering
216 allows component- or application-specific overrides of earlier
217 settings. For example, there may be Reader-specific overrides of
218 general settings; Writer-specific overrides of Parser settings;
219 Application-specific overrides of Writer settings; and so on.
220
221 If multiple configuration files are applicable, the process is
222 completed (all sections are applied in the order given) for each one
223 before going on to the next. For example, a "[pep_html writer]
224 stylesheet" setting in an earlier configuration file would be
225 overridden by an "[html4css1 writer] stylesheet" setting in a later
226 file.
227
228 Individual configuration sections and settings are described
229 in the following sections.
230 Some knowledge of Python_ is assumed for some attributes.
231
232
233 .. _Python: https://www.python.org/
234 __ ../api/runtime-settings.html#active-sections
235
236
237 [general]
238 =========
239
240 Settings in the "[general]" section are always applied.
241
242
243 auto_id_prefix
244 --------------
245
246 Prefix for identifiers_ of elements without a `reference name`_
247 (after an eventual id_prefix_).
248
249 The value is not subjected to the `identifier normalization`_ so users
250 must ensure it conforms to the restrictions on identifiers in the output
251 format. A trailing "%" is replaced with the Doctree_ element name;
252 a number is added for disambiguation. With the default, the third
253 `anonymous hyperlink target`_, for example, would get the ID "target-3".
254
255 :Default: "%" (use Doctree element name; changed from "id" in Docutils 0.18).
256 :Option: ``--auto-id-prefix`` (hidden, intended mainly for programmatic use).
257
258 .. _identifier normalization:
259 ../ref/rst/directives.html#identifier-normalization
260
261
262 datestamp
263 ---------
264
265 Include a time/datestamp in the document footer. Contains a
266 format string for Python's `time.strftime()`__.
267
268 Configuration file entry examples::
269
270 # Equivalent to --date command-line option, results in
271 # ISO 8601 extended format datestamp, e.g. "2001-12-21":
272 datestamp: %Y-%m-%d
273
274 # Equivalent to --time command-line option, results in
275 # date/timestamp like "2001-12-21 18:43 UTC":
276 datestamp: %Y-%m-%d %H:%M UTC
277
278 # Disables datestamp; equivalent to --no-datestamp:
279 datestamp:
280
281 :Default: None.
282 :Options: ``--date``, ``-d``, ``--time``, ``-t``, ``--no-datestamp``.
283
284 __ https://docs.python.org/3/library/time.html#time.strftime
285
286
287 debug
288 -----
289
290 Report debug-level system messages.
291
292 *Default*: None (disabled). *Options*: ``--debug``, ``--no-debug``.
293
294
295 dump_internals
296 --------------
297
298 At the end of processing, write all internal attributes of the
299 document (``document.__dict__``) to stderr.
300
301 *Default*: None (disabled).
302 *Option*: ``--dump-internals`` (hidden, for development use only).
303
304
305 dump_pseudo_xml
306 ---------------
307
308 At the end of processing, write the pseudo-XML representation of
309 the document to stderr.
310
311 *Default*: None (disabled).
312 *Option*: ``--dump-pseudo-xml`` (hidden, for development use only).
313
314
315 dump_settings
316 -------------
317
318 At the end of processing, write all Docutils settings to stderr.
319
320 *Default*: None (disabled).
321 *Option*: ``--dump-settings`` (hidden, for development use only).
322
323
324 dump_transforms
325 ---------------
326
327 At the end of processing, write a list of all transforms applied
328 to the document to stderr.
329
330 *Default*: None (disabled).
331 *Option*: ``--dump-transforms`` (hidden, for development use only).
332
333
334 error_encoding
335 --------------
336
337 The text encoding [#encodings]_ for error output.
338
339 :Default: The encoding reported by ``sys.stderr``, locale encoding, or "ascii".
340 :Options: ``--error-encoding``, ``-e`` (deprecated).
341
342
343 error_encoding_error_handler
344 ----------------------------
345
346 The error handler for unencodable characters in error output.
347 Acceptable values are the `Error Handlers`_ of Python's "codecs" module.
348 See also output_encoding_error_handler_.
349
350 The error handler may also be appended to the error_encoding_
351 setting, delimited by a colon, e.g. ``--error-encoding=ascii:replace``.
352
353 :Default: "backslashreplace"
354 :Options: ``--error-encoding-error-handler``
355 (hidden, intended mainly for programmatic use).
356
357
358 exit_status_level
359 -----------------
360
361 A system message level threshold; non-halting system messages at
362 or above this level will produce a non-zero exit status at normal
363 exit. Exit status is the maximum system message level plus 10 (11
364 for INFO, etc.).
365
366 *Default*: 5 (disabled). *Option*: ``--exit-status``.
367
368
369 expose_internals
370 ----------------
371
372 List of internal attributes (colon-separated_) to expose
373 as external attributes (with "internal:" namespace prefix).
374 Values are appended. [#append-values]_
375
376 *Default*: empty list.
377 *Option*: ``--expose-internal-attribute`` (hidden, for development use only).
378
379
380 footnote_backlinks
381 ------------------
382
383 Enable backlinks from footnotes_ and citations_ to their references.
384
385 :Default: True.
386 :Options: ``--footnote-backlinks``, ``--no-footnote-backlinks``.
387
388
389 generator
390 ---------
391
392 Include a "Generated by Docutils" credit and link in the document footer.
393
394 :Default: None (disabled).
395 :Options: ``--generator``, ``-g``, ``--no-generator``.
396
397
398 halt_level
399 ----------
400
401 The threshold at or above which system messages are converted to
402 exceptions, halting execution immediately. If `traceback`_ is set, the
403 exception will propagate; otherwise, Docutils will exit.
404
405 See also report_level_.
406
407 :Default: 4 (severe).
408 :Options: ``--halt``, ``--strict`` (same as ``--halt=info``).
409
410
411 id_prefix
412 ---------
413
414 Prefix prepended to all identifiers_. See also auto_id_prefix_.
415
416 Use cases include tagging of all Docutils-generated element IDs and
417 enabling leading numerals in `reference names`_ to pass the
418 `identifier normalization`_.
419
420 Users must ensure the value conforms to the restrictions on identifiers in
421 the output format, as it is not subjected to the `identifier normalization`_.
422
423 :Default: "" (no prefix).
424 :Option: ``--id-prefix`` (hidden, intended mainly for programmatic use).
425
426
427 input_encoding
428 --------------
429
430 The text encoding [#encodings]_ for input.
431
432 :Default: utf-8 (changed from None (auto-detect_) in Docutils 0.22).
433 :Option: ``--input-encoding`` (shortcut ``-i`` removed in Docutils 0.22).
434
435
436 input_encoding_error_handler
437 ----------------------------
438
439 The error handler for undecodable characters in the input.
440 Acceptable values are the `Error Handlers`_ of Python's "codecs" module,
441 including:
442
443 strict
444 Raise an exception in case of an encoding error.
445 replace
446 Replace malformed data with the official Unicode replacement
447 character � (U+FFFD).
448 ignore
449 Ignore malformed data and continue without further notice.
450
451 The error handler may also be appended to the input_encoding_
452 setting, delimited by a colon, e.g. ``--input-encoding=ascii:replace``.
453
454 :Default: "strict".
455 :Options: ``--input-encoding-error-handler``
456 (hidden, intended mainly for programmatic use).
457
458
459 language_code
460 -------------
461
462 Case-insensitive `language tag`_ as defined in `BCP 47`_.
463
464 Sets the document language, also used for localized directive and
465 role names as well as Docutils-generated text.
466
467 A typical language identifier consists of a 2-letter language code
468 from `ISO 639`_ (3-letter codes can be used if no 2-letter code
469 exists). The language identifier can have an optional subtag,
470 typically for variations based on country (from `ISO 3166`_
471 2-letter country codes). Avoid subtags except where they add
472 useful distinguishing information. Examples of language tags
473 include "fr", "en-GB", "pt-br" (the same as "pt-BR"), and
474 "de-1901" (German with pre-1996 spelling).
475
476 The language of document parts can be specified with a
477 "language-<language tag>" `class attribute`_, e.g.
478 ``.. class:: language-grc`` for a quote in Ancient Greek.
479
480 *Default*: "en" (English). *Options*: ``--language``, ``-l``.
481
482
483 output_path
484 -----------
485
486 Output file path or "-" for `stdout`.
487
488 .. Caution:: **An existing file will be overwritten** without warning!
489
490 Obsoletes the second `positional argument`_ and the internal
491 `_destination`_ setting (cf. `Future changes`_ in the RELEASE-NOTES).
492
493 :Default: None (write to stdout).
494 :Options: ``--output-path``, ``--output``.
495
496 New in Docutils 0.20.
497 Renamed from "_`output`" to "output_path" in Docutils 0.22.
498
499
500 output_encoding
501 ---------------
502
503 The text encoding [#encodings]_ for output.
504 The special value "unicode" can be used with
505 the Publisher convenience functions `publish_string()`_ and
506 `publish_from_doctree()`_ to skip encoding and return a `str` instance
507 instead of `bytes`.
508
509 .. Note::
510 * The "output_encoding" setting may affect the content of the output
511 (e.g. an encoding declaration in HTML or XML or the representation
512 of characters as LaTeX macro vs. literal character).
513 * Docutils may introduce non-ASCII text if you use
514 `auto-symbol footnotes`_.
515 In non-English documents, also auto-generated labels
516 may contain non-ASCII characters.
517
518 This setting is ignored by the `ODF/ODT Writer`_ which always uses UTF-8.
519
520 :Default: "utf-8".
521 :Option: ``--output-encoding`` (shortcut ``-o`` removed in Docutils 0.22).
522
523
524 output_encoding_error_handler
525 -----------------------------
526
527 The error handler for unencodable characters in the output.
528 Acceptable values are the `Error Handlers`_ of Python's "codecs" module,
529 including:
530
531 strict
532 Raise an exception in case of an encoding error.
533 replace
534 Replace malformed data with a suitable replacement marker,
535 such as "?".
536 ignore
537 Ignore malformed data and continue without further notice.
538 xmlcharrefreplace
539 Replace with the appropriate XML character reference, such as
540 "``&#8224;``".
541 backslashreplace
542 Replace with backslash escape sequences, such as "``\u2020``".
543
544 The error handler may also be appended to the output_encoding_
545 setting using a colon as delimiter, e.g.
546 ``--output-encoding=ascii:xmlcharrefreplace``.
547
548 :Default: "strict".
549 :Options: ``--output-encoding-error-handler``
550 (hidden, intended mainly for programmatic use).
551
552
553 record_dependencies
554 -------------------
555
556 Path to a file where Docutils will write a list of files that
557 were required to generate the output, e.g. included files or embedded
558 stylesheets. [#dependencies]_ The format is one path per line with
559 forward slashes as separator, the encoding is UTF-8.
560
561 Set it to "-" in order to write dependencies to stdout.
562
563 This option is particularly useful in conjunction with programs like
564 ``make`` using ``Makefile`` rules like::
565
566 ham.html: ham.rst $(shell cat hamdeps.rst)
567 rst2html --record-dependencies=hamdeps.rst ham.rst > ham.html
568
569 If the filesystem encoding differs from UTF-8, replace the ``cat``
570 command with a call to a converter, e.g.::
571
572 $(shell iconv -f utf-8 -t latin1 hamdeps.rst)
573
574 *Default*: None (disabled). *Option*: ``--record-dependencies``.
575
576 .. [#dependencies] Images are only added to the dependency list if they
577 are embedded into the output or the reStructuredText parser extracted
578 image dimensions from the file.
579
580
581 report_level
582 ------------
583
584 Report system messages at or higher than the given `severity level`_:
585
586 1 info,  2 warning,  3 error,  4 severe,  5 none
587
588 See also halt_level_.
589
590 :Default: 2 (warning).
591 :Options: | ``--report``, ``-r`` (with level as number or name)
592 | ``--verbose``, ``-v`` (same as ``--report=1``)
593 | ``--quiet``, ``-q`` (same as ``--report=5``)
594
595
596 root_prefix
597 -----------
598
599 Base directory, prepended to a filesystem path__ starting with "/" when
600 including files with the `"include"`_, `"raw"`_, or `"csv-table"`_
601 directives.
602 Also applied to the `"uri" attribute`_ of an <image> or <figure> starting
603 with "/" when it is converted to a local filesystem path.
604 Not applied to absolute Windows paths and ``file:`` URIs.
605
606 Example:
607 The HTML server for a documentation project serves files from the
608 "DocumentRoot" ``/var/www/html/``.
609 Image files are stored in a dedicated directory ``/var/www/html/pictures/``.
610
611 With ``root-prefix=/var/www/html``, the rST "image" directive ::
612
613 .. image:: /pictures/mylogo.png
614
615 works for LaTeX output and HTML output with embedded images as well as
616 for HTML output with images included via URI reference.
617
618 :Default: "" (empty string).
619 :Option: ``--root-prefix``.
620
621 New in Docutils 0.21.
622
623 __ ../ref/rst/directives.html#path
624
625
626 sectnum_xform
627 -------------
628
629 Enable automatic section numbering by Docutils (`SectNum` transform_
630 associated with the `"sectnum" directive`_).
631
632 If disabled, the `SectNum` transform adds the `internal settings`_
633 sectnum_depth_, sectnum_start_, sectnum_prefix_, and sectnum_suffix_
634 to store the respective `"sectnum" directive options`__.
635 Section numbers may be added to the output by the renderer
636 (e.g. by CSS style rules or LaTeX).
637
638 __ ../ref/rst/directives.html#sectnum-options
639
640 :Default: True.
641 :Options: ``--section-numbering``, ``--no-section-numbering``.
642
643
644 source_link
645 -----------
646
647 Include a "View document source" link in the document footer. The URL will
648 be relative to the output_path_ (if specified) or the current work directory.
649
650 :Default: None (disabled).
651 :Options: ``--source-link``, ``-s``, ``--no-source-link``.
652
653
654 source_url
655 ----------
656
657 An explicit URL for a "View document source" link, used verbatim.
658
659 :Default: None (compute from source_link_).
660 :Options: ``--source-url``, ``--no-source-link``.
661
662
663 strict_visitor
664 --------------
665
666 When processing a `document tree`_ with the Visitor pattern, raise an
667 error if a writer does not support a node type listed as optional.
668 For transitional development use.
669
670 :Default: None (disabled).
671 :Option: ``--strict-visitor`` (hidden, for development use only).
672
673
674 strip_classes
675 -------------
676
677 List of "classes" attribute values (comma-separated_) that will be
678 removed from all elements in the `document tree`_.
679 Values are appended. [#append-values]_
680
681 Allows eliding class values that interfere with, e.g, CSS rules from 3rd
682 party tools/frameworks.
683
684 .. WARNING:: Some standard class values are required in order to achieve
685 the expected output rendering; use with caution.
686
687 *Default*: empty list. *Option*: ``--strip-class``.
688
689
690 strip_comments
691 --------------
692
693 Enable or disable the removal of comment elements from the `document tree`_.
694
695 :Default: None (disabled).
696 :Options: ``--strip-comments``, ``--leave-comments``.
697
698
699 strip_elements_with_classes
700 ---------------------------
701
702 List of "classes" attribute values (comma-separated_).
703 Values are appended. [#append-values]_
704 Matching elements are removed from the `document tree`_
705 (by the `StripClassesAndElements` transform_).
706
707 .. WARNING:: Potentially dangerous: may lead to an invalid document tree
708 and subsequent writer errors. Use with caution.
709 It is recommended to validate_ the document.
710
711 *Default*: empty list. *Option*: ``--strip-elements-with-class``.
712
713
714 title
715 -----
716
717 The `document title` as metadata which does not become part of the
718 document body. Stored as the document's `title attribute`_.
719 For example, in HTML output the metadata document title
720 appears in the title bar of the browser window.
721
722 This setting overrides a displayed `document title`_ and
723 is overridden by a `"title" directive`_.
724
725 :Default: None (the displayed `document title`_).
726 :Option: ``--title``.
727
728
729 toc_backlinks
730 -------------
731
732 Enable backlinks from section titles to table of contents entries
733 ("entry"), to the top of the ToC ("top"), or disable (False).
734
735 :Default: "entry".
736 :Options: ``--toc-entry-backlinks``, ``--toc-top-backlinks``,
737 ``--no-toc-backlinks``.
738
739
740 traceback
741 ---------
742
743 Enable or disable Python tracebacks when system messages with
744 a severity above the `halt_level`_ and other exceptions occur.
745 Useful for debugging, and essential for issue reports.
746 Exceptions are allowed to propagate, instead of being
747 caught and reported (in a user-friendly way) by Docutils.
748
749 :Default: None (disabled). [#]_
750 :Options: ``--traceback``, ``--no-traceback``.
751
752 .. [#] unless Docutils is run programmatically
753 using the `Publisher Interface`_
754
755
756 warning_stream
757 --------------
758
759 Path [#pwd]_ to a file for the output of system messages (warnings).
760
761 *Default*: None (stderr). *Option*: ``--warnings``.
762
763
764 [parsers]
765 =========
766
767 Generic parser options:
768
769 file_insertion_enabled
770 ----------------------
771
772 Enable directives inserting the contents of external files,
773 such as `"include"`_ directive or the `"raw"`_ and `"csv-table"`_
774 directives with option "url" or "file".
775
776 If disabled, a "warning" system message (including the directive text) is
777 inserted instead. (See also raw_enabled_ for another security-relevant
778 setting.)
779
780 :Default: True (enabled).
781 :Options: ``--file-insertion-enabled``, ``--no-file-insertion``.
782
783
784 line_length_limit
785 -----------------
786
787 Maximal number of characters in an input line or `"substitution"`_
788 definition. To prevent extraordinary high processing times or memory
789 usage for certain input constructs, a "warning" system message is
790 inserted instead.
791
792 *Default*: 10 000.
793 *Option*: ``--line-length-limit``
794
795 New in Docutils 0.17.
796
797
798 legacy_ids
799 ----------
800
801 Keep element identifiers_ compatible to Docutils ≤ 0.22.
802
803 In case of a name conflict with an `implicit target`_ (section heading),
804 identifiers_ may have a disambiguating number added to the normalized
805 `reference name`_.
806
807 :Default: True; will change to False in Docutils 2.0.
808 :Option: ``--legacy-ids``, ``--matching-ids``.
809
810 New in Docutils 0.23. Provisional.
811
812
813 raw_enabled
814 -----------
815
816 Enable the `"raw" directive`_.
817
818 If disabled, a "warning" system message (including the directive text) is
819 inserted instead. See also file_insertion_enabled_ for another
820 security-relevant setting.
821
822 :Default: True (enabled).
823 :Options: ``--raw-enabled``, ``--no-raw``.
824
825
826 validate
827 --------
828
829 Validate the parsing result. Report elements that do not comply
830 with the restrictions set out in the `Docutils Generic document
831 type definition`_.
832
833 *Default*: False. *Options*: ``--validate``, ``--no-validation``.
834
835
836 [restructuredtext parser]
837 -------------------------
838
839 character_level_inline_markup
840 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
841 Relax the `inline markup recognition rules`_
842 requiring whitespace or punctuation around inline markup.
843
844 Allows character level inline markup without escaped whithespace and is
845 especially suited for languages that do not use whitespace to separate words
846 (e.g. Japanese, Chinese).
847
848 .. WARNING:: Potentially dangerous; use with caution.
849
850 When changing this setting to "True", inline markup characters in
851 URLs, names and formulas must be escaped to prevent recognition and
852 possible errors.
853
854 Examples:
855 .. class:: borderless
856
857 =========================== ====================================
858 ``http://rST_for_all.html`` hyperlinks to ``rST_`` and ``for_``
859 ``x_2, inline_markup`` hyperlinks to ``x_`` and ``inline_``
860 ``2*x`` starts emphasised text
861 ``a|b`` starts a substitution reference
862 =========================== ====================================
863
864 :Default: False.
865 :Options: ``--character-level-inline-markup``, ``--word-level-inline-markup``.
866
867 pep_references
868 ~~~~~~~~~~~~~~
869 Recognize and link to standalone PEP references (like "PEP 258").
870
871 :Default: None (disabled); True in the `PEP Reader`_.
872 :Option: ``--pep-references``.
873
874 pep_base_url
875 ~~~~~~~~~~~~
876 Base URL for PEP references.
877
878 *Default*: "https://peps.python.org/".
879 *Option*: ``--pep-base-url``.
880
881 pep_file_url_template
882 ~~~~~~~~~~~~~~~~~~~~~
883 Template for PEP file part of URL, interpolated with the PEP
884 number and appended to pep_base_url_.
885
886 *Default*: "pep-%04d". *Option*: ``--pep-file-url``.
887
888 rfc_references
889 ~~~~~~~~~~~~~~
890 Recognize and link to standalone RFC references (like "RFC 822").
891
892 :Default: None (disabled); True in the `PEP Reader`_.
893 :Option: ``--rfc-references``.
894
895 rfc_base_url
896 ~~~~~~~~~~~~
897 Base URL for RFC references.
898
899 *Default*: "https://tools.ietf.org/html/". *Option*: ``--rfc-base-url``.
900
901 smart_quotes
902 ~~~~~~~~~~~~
903 Activate the SmartQuotes_ transform to
904 change straight quotation marks to typographic form. `Quote characters`_
905 are selected according to the language of the current block element (see
906 language_code_, smartquotes_locales_, and the `pre-defined quote sets`_).
907
908 Also changes consecutive runs of hyphen-minus and full stops (``---``,
909 ``--``, ``...``) to em-dash, en-dash, and ellipsis Unicode characters
910 respectively.
911
912 Supported values:
913
914 :boolean_: Use smart quotes?
915 :alt: Use alternative quote set (if defined for the language).
916
917 *Default*: None (disabled). *Option*: ``--smart-quotes``.
918
919 .. _SmartQuotes: smartquotes.html
920 .. _pre-defined quote sets: smartquotes.html#localization
921 .. _quote characters:
922 https://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks
923
924 smartquotes_locales
925 ~~~~~~~~~~~~~~~~~~~
926
927 List with language tag and a string of four typographical quote
928 characters (primary open/close, secondary open/close) for use by
929 the SmartQuotes_ transform.
930 Values are appended. [#append-values]_
931
932 Example:
933 Ensure a correct leading apostrophe in ``'s Gravenhage`` in Dutch (at the
934 cost of incorrect opening single quotes) and set French quotes to double
935 and single guillemets with inner padding [#]_::
936
937 smartquote-locales: nl: „”’’,
938 fr: « : »:‹ : ›
939
940 :Default: SmartQuotes' `pre-defined quote sets`_.
941 :Option: ``--smartquotes-locales``.
942
943 .. [#] If more than one character per quote is required (e.g. padding in
944 French quotes), a colon-separated list may be used for the quote set.
945
946 syntax_highlight
947 ~~~~~~~~~~~~~~~~
948 Token type names used by Pygments_ when parsing contents of the `"code"`_
949 directive and role.
950
951 Supported values:
952
953 :long: Use hierarchy of long token type names.
954 :short: Use short token type names.
955 (For use with `Pygments-generated stylesheets`_.)
956 :none: No code parsing. Use this to avoid the "Pygments not
957 found" warning when Pygments is not installed.
958
959 *Default*: "long". *Option*: ``--syntax-highlight``.
960
961 .. _Pygments: https://pygments.org/
962 .. _Pygments-generated stylesheets:
963 https://pygments.org/docs/cmdline/#generating-styles
964
965 tab_width
966 ~~~~~~~~~
967 Number of spaces for `hard tab expansion`_.
968
969 *Default*: 8. *Option*: ``--tab-width``.
970
971 .. _hard tab expansion: ../ref/rst/restructuredtext.html#whitespace
972
973 trim_footnote_reference_space
974 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
975 Remove spaces before `footnote references`_?
976
977 :Default: None (depends on the `footnote_references setting`_ [#]_).
978 :Options: ``--trim-footnote-reference-space``,
979 ``--leave-footnote-reference-space``.
980
981 .. [#] The footnote space is trimmed if the reference style is "superscript",
982 and it is left if the reference style is "brackets".
983
984
985 [myst parser]
986 -------------
987
988 Parser for Markdown (CommonMark_) with rST-compatibility extensions
989 provided by the 3rd party package `myst-docutils`_.
990 See `MyST with Docutils`_ and MyST's `Sphinx configuration options`_.
991 (Some settings are not applicable with Docutils,
992 ``docutils --parser=myst --help`` shows available options.)
993
994 .. _CommonMark: https://spec.commonmark.org/current/
995 .. _myst-docutils: https://pypi.org/project/myst-docutils/
996 .. _MyST with Docutils:
997 https://myst-parser.readthedocs.io/en/latest/docutils.html
998 .. _Sphinx configuration options:
999 https://myst-parser.readthedocs.io/en/latest/sphinx/reference.html#sphinx-config-options
1000
1001
1002 [pycmark parser]
1003 ----------------
1004
1005 Parser for Markdown (CommonMark_)
1006 provided by the 3rd party package `pycmark`_.
1007 Currently no configuration settings.
1008
1009 .. _pycmark: https://pypi.org/project/pycmark/
1010
1011
1012 [recommonmark parser]
1013 ---------------------
1014
1015 Parser for Markdown (CommonMark_)
1016 provided by the 3rd party package recommonmark_.
1017
1018 .. admonition:: Deprecated
1019
1020 Depends on deprecated 3rd-party package recommonmark_.
1021 Support will be removed in Docutils 1.0.
1022
1023 Currently no configuration settings.
1024
1025 .. _recommonmark: https://pypi.org/project/recommonmark/
1026
1027
1028 [xml parser]
1029 ------------
1030
1031 The `Docutils XML parser` processes an XML representation of a
1032 `Docutils Document Tree`_
1033 (e.g. the output of the `Docutils XML writer <[docutils_xml writer]_>`__).
1034
1035 New in Docutils 0.22
1036
1037 Parser Specific Defaults
1038 ~~~~~~~~~~~~~~~~~~~~~~~~
1039 .. class:: run-in narrow
1040
1041 :doctitle_xform_: False.
1042 :validate_: True.
1043
1044
1045 [readers]
1046 =========
1047
1048 [standalone reader]
1049 -------------------
1050
1051 docinfo_xform
1052 ~~~~~~~~~~~~~
1053 Enable the DocInfo_ transform for `bibliographic fields`_.
1054
1055 *Default*: True. *Options*: ``--no-doc-info``.
1056
1057 doctitle_xform
1058 ~~~~~~~~~~~~~~
1059 Enable the promotion of a lone top-level section title
1060 to the `document title`_ (and subsequent section title
1061 to document subtitle) by the DocTitle_ transform.
1062
1063 *Default*: True. *Options*: ``--no-doc-title``.
1064
1065 sectsubtitle_xform
1066 ~~~~~~~~~~~~~~~~~~
1067 Enable the promotion of the title of a lone subsection
1068 to a subtitle by the SectSubTitle_ transform.
1069
1070 :Default: False.
1071 :Options: ``--section-subtitles``, ``--no-section-subtitles``.
1072
1073
1074 .. _PEP Reader:
1075
1076 [pep reader]
1077 ------------
1078
1079 Writer Specific Defaults
1080 ~~~~~~~~~~~~~~~~~~~~~~~~
1081
1082 .. class:: run-in
1083
1084 :`pep_references`_: True
1085 :`rfc_references`_: True
1086
1087
1088 .. [python reader]
1089 ---------------
1090
1091 Not implemented.
1092
1093
1094 [writers]
1095 =========
1096
1097 [docutils_xml writer]
1098 ---------------------
1099
1100 doctype_declaration
1101 ~~~~~~~~~~~~~~~~~~~
1102 Generate XML with a DOCTYPE declaration.
1103
1104 *Default*: True. *Options*: ``--no-doctype``.
1105
1106 indents
1107 ~~~~~~~
1108 Generate XML with indents and newlines.
1109
1110 *Default*: None (disabled). *Options*: ``--indents``.
1111
1112 newlines
1113 ~~~~~~~~
1114 Generate XML with newlines before and after block-level tags.
1115
1116 *Default*: None (disabled). *Options*: ``--newlines``.
1117
1118
1119 .. _xml_declaration [docutils_xml writer]:
1120
1121 xml_declaration
1122 ~~~~~~~~~~~~~~~
1123 Generate XML with an XML declaration.
1124 See also `xml_declaration [html writers]`_.
1125
1126 .. Caution:: The XML declaration carries text encoding information.
1127 If the encoding is not UTF-8 or ASCII and the XML declaration is
1128 missing, standard tools may be unable to read the generated XML.
1129
1130 *Default*: True. *Option*: ``--no-xml-declaration``.
1131
1132
1133 [html writers]
1134 --------------
1135
1136 Common settings for the `Docutils HTML writers`_.
1137
1138 .. _attribution [html writers]:
1139
1140 attribution
1141 ~~~~~~~~~~~
1142 Format for `block quote`_ attributions: one of "dash" (em-dash
1143 prefix), "parentheses"/"parens", or "none".
1144 See also `attribution [latex writers]`_.
1145
1146 *Default*: "dash". *Option*: ``--attribution``.
1147
1148
1149 cloak_email_addresses
1150 ~~~~~~~~~~~~~~~~~~~~~
1151 Scramble email addresses to confuse harvesters. In the reference
1152 URI, the "@" will be replaced by %-escapes (as of RFC 1738). In
1153 the visible text (link text) of an email reference, the "@" and
1154 all periods (".") will be surrounded by ``<span>`` tags.
1155 Furthermore, HTML entities are used to encode these characters in
1156 order to further complicate decoding the email address. For
1157 example, "[email protected]" will be output as::
1158
1159 <a class="reference" href="mailto:abc&#37;&#52;&#48;example&#46;org">
1160 abc<span>&#64;</span>example<span>&#46;</span>org</a>
1161
1162 .. Note:: While cloaking email addresses will have little to no
1163 impact on the rendering and usability of email links in most
1164 browsers, some browsers (e.g. the ``links`` browser) may decode
1165 cloaked email addresses incorrectly.
1166
1167 *Default*: None (disabled). *Option*: ``--cloak-email-addresses``.
1168
1169 compact_lists
1170 ~~~~~~~~~~~~~
1171 Remove extra vertical whitespace between items of `bullet lists`_ and
1172 `enumerated lists`_, when list items are all "simple" (i.e., items
1173 each contain one paragraph and/or one "simple" sub-list only).
1174 With the "html5" writer, the setting can be overridden for individual
1175 lists using the `"class" directive`_ (values "compact" and "open").
1176
1177 :Default: True.
1178 :Options: ``--compact-lists``, ``--no-compact-lists``.
1179
1180
1181 compact_field_lists
1182 ~~~~~~~~~~~~~~~~~~~
1183 Remove extra vertical whitespace between items of `field lists`_ that
1184 are "simple" (i.e., all field bodies each contain at most one paragraph).
1185 With the "html5" writer, the setting can be overridden for individual
1186 lists using the `"class" directive`_ (values "compact" and "open").
1187
1188 :Default: True.
1189 :Options: ``--compact-field-lists``, ``--no-compact-field-lists``.
1190
1191
1192 .. _embed_stylesheet [html writers]:
1193
1194 embed_stylesheet
1195 ~~~~~~~~~~~~~~~~
1196 Embed stylesheet(s) in the HTML output. The stylesheet files
1197 must be specified by the stylesheet_path_ setting and must be
1198 accessible during processing.
1199 See also `embed_stylesheet [latex writers]`_.
1200
1201 :Default: True.
1202 :Options: ``--embed-stylesheet``, ``--link-stylesheet``.
1203
1204
1205 .. _footnote_references setting:
1206 .. _footnote_references [html writers]:
1207
1208 footnote_references
1209 ~~~~~~~~~~~~~~~~~~~
1210 Format for `footnote references`_, one of "superscript" or "brackets".
1211 See also `footnote_references [latex writers]`_.
1212
1213 Overrides also trim_footnote_reference_space_,
1214 if the parser supports this option. [#override]_
1215
1216 *Default*: "brackets". *Option*: ``--footnote-references``.
1217
1218 initial_header_level
1219 ~~~~~~~~~~~~~~~~~~~~
1220 The level of the first *section* heading element
1221 (the `document title`_ always uses <h1>).
1222 Supported values:
1223
1224 :1, ..., 6: <h1>, ..., <h6>,
1225 :auto: <h2> if there is a `document title`_, else <h1>. [#auto-header-level]_
1226
1227 See also `doctitle_xform`_.
1228
1229 :Default: writer dependent
1230 (see `[html4css1 writer]`_, `[html5 writer]`_, `[pep_html writer]`_).
1231 :Option: ``--initial-header-level``.
1232
1233 .. [#auto-header-level] Ensures the HTML document has a valid outline__
1234 in documents with/without a document title.
1235 New in Docutils 0.22.3.
1236 __ https://html.spec.whatwg.org/multipage/sections.html#outline
1237
1238 math_output
1239 ~~~~~~~~~~~
1240 The format of mathematical content (`"math" directive`_ and role) in
1241 the output document. Supported values are (case insensitive):
1242
1243 HTML:
1244 Format math in standard HTML enhanced by CSS rules.
1245 Requires the ``math.css`` stylesheet (in the system
1246 `stylesheet directory <stylesheet_dirs [html writers]_>`__)
1247
1248 A `stylesheet_path <stylesheet_path [html writers]_>`__
1249 can be appended after whitespace. The specified
1250 stylesheet(s) will only be referenced or embedded if required
1251 (i.e. if there is mathematical content in the document).
1252
1253 MathML:
1254 Embed math content as presentational MathML_.
1255
1256 Self-contained documents (no JavaScript, no external downloads).
1257 MathML is part of the HTML5 standard [#mathml-in-html4]_ and
1258 `supported by all major browsers`__ (since January 2023 also by Chrome).
1259
1260 .. [#mathml-in-html4]
1261 With the "html4css1" writer, the resulting HTML document does
1262 not validate, as there is no DTD for `MathML + XHTML Transitional`.
1263 However, MathML-enabled browsers will render it fine.
1264
1265 Docutil's latex2mathml converter supports a considerable
1266 `subset of LaTeX math syntax`__.
1267
1268 An external converter can be appended after whitespace, e.g.,
1269 ``--math-output="MathML blahtexml"``:
1270
1271 .. class:: run-in narrow
1272
1273 :blahtexml_: Fast conversion, support for many symbols and environments,
1274 but no "align" (or other equation-aligning) environment. (C++)
1275 :LaTeXML_: Comprehensive macro support but **very** slow. (Perl)
1276 :TtM_: No "matrix", "align" and "cases" environments.
1277 Support may be removed.
1278 :Pandoc_: Comprehensive macro support, fast, but a large install size.
1279 (Haskell)
1280
1281 __ https://developer.mozilla.org/en-US/docs/Web/MathML#browser_compatibility
1282 __ ../ref/rst/mathematics.html
1283
1284 MathJax:
1285 Format math for display with MathJax_, a JavaScript-based math rendering
1286 engine.
1287
1288 :Pro: Works across multiple browsers and platforms.
1289 Large set of `supported LaTeX math commands and constructs`__
1290 :Con: Rendering requires JavaScript and an Internet connection or local
1291 MathJax installation.
1292
1293 __ https://docs.mathjax.org/en/latest/input/tex/macros/index.html
1294
1295 A URL pointing to a MathJax library should be appended after whitespace.
1296 A warning is given if this is missing.
1297
1298 * It is recommended to install__ the MathJax library on the same
1299 server as the rest of the deployed site files.
1300
1301 __ https://www.mathjax.org/#installnow
1302
1303 Example: Install the library at the top level of the web
1304 server’s hierarchy in the directory ``MathJax`` and set::
1305
1306 math-output: mathjax /MathJax/MathJax.js
1307
1308 * The easiest way to use MathJax is to link directly to a public
1309 installation. In that case, there is no need to install MathJax locally.
1310
1311 Downside: Downloads JavaScript code from a third-party site --- opens
1312 the door to cross-site scripting attacks!
1313
1314 Example: MathJax `getting started`__ documentation uses::
1315
1316 math-output: mathjax
1317 https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
1318
1319 See https://www.jsdelivr.com/ for details and terms of use.
1320
1321 __ https://www.mathjax.org/#gettingstarted
1322
1323 * Use a local MathJax installation on the *client* machine, e.g.::
1324
1325 math-output: MathJax file:/usr/share/javascript/mathjax/MathJax.js
1326
1327 This is the fallback if no URL is specified.
1328
1329 LaTeX:
1330 Include literal LaTeX code.
1331
1332 The failsafe fallback.
1333
1334 :Default: writer dependent (see `[html4css1 writer]`_, `[html5 writer]`_).
1335 :Option: ``--math-output``.
1336
1337 .. _MathJax: https://www.mathjax.org/
1338 .. _MathML: https://www.w3.org/TR/MathML/
1339 .. _blahtexml: https://gva.noekeon.org/blahtexml/
1340 .. _LaTeXML: https://math.nist.gov/~BMiller/LaTeXML/
1341 .. _TtM: http://silas.psfc.mit.edu/tth/mml/
1342 .. _Pandoc: https://pandoc.org/
1343
1344
1345 .. _stylesheet:
1346 .. _stylesheet [html writers]:
1347
1348 stylesheet
1349 ~~~~~~~~~~
1350 List of CSS stylesheet URLs (comma-separated_). Used verbatim.
1351
1352 Overrides also stylesheet_path_. [#override]_
1353 See also `stylesheet [latex writers]`_.
1354
1355 *Default*: empty list. *Option*: ``--stylesheet``.
1356
1357
1358 .. _stylesheet_dirs:
1359 .. _stylesheet_dirs [html writers]:
1360
1361 stylesheet_dirs
1362 ~~~~~~~~~~~~~~~
1363 List of directories where stylesheets can be found (comma-separated_).
1364 Used by the stylesheet_path_ setting when resolving relative path arguments.
1365
1366 See also `stylesheet_dirs [latex writers]`_.
1367
1368 Note: This setting defines a "search path" (similar to the PATH variable for
1369 executables). However, the term "path" is already used in the
1370 stylesheet_path_ setting with the meaning of a file location.
1371
1372 :Default: the working directory of the process at launch
1373 and the directory with default stylesheet files
1374 (writer and installation specific).
1375 Use the ``--help`` option to get the exact value.
1376 :Option: ``--stylesheet-dirs``.
1377
1378
1379 .. _stylesheet_path:
1380 .. _stylesheet_path [html writers]:
1381
1382 stylesheet_path
1383 ~~~~~~~~~~~~~~~
1384 List of paths to CSS stylesheets (comma-separated_). Relative paths are
1385 expanded if a matching file is found in the stylesheet_dirs__.
1386 If embed_stylesheet__ is False, paths are rewritten relative to
1387 the output_path_ (if specified) or the current work directory.
1388
1389 See also `stylesheet_path [latex writers]`_.
1390
1391 Overrides also stylesheet_. [#override]_
1392 Pass an empty string (to either "stylesheet" or "stylesheet_path") to
1393 deactivate stylesheet inclusion.
1394
1395 :Default: writer dependent (see `[html4css1 writer]`_,
1396 `[html5 writer]`_, `[pep_html writer]`_).
1397 :Option: ``--stylesheet-path``.
1398
1399 __ `embed_stylesheet [html writers]`_
1400 __ `stylesheet_dirs [html writers]`_
1401
1402
1403 .. _table_style [html writers]:
1404
1405 table_style
1406 ~~~~~~~~~~~
1407 Class value(s) assigned to all tables_.
1408 See also `table_style [latex writers]`_.
1409
1410 The default CSS sylesheets define:
1411
1412 :borderless: no borders around table cells,
1413 :align-left, align-center, align-right: align table.
1414
1415 The HTML5 stylesheets also define:
1416
1417 :booktabs:
1418 Only lines above and below the table and a thin line after the head.
1419 :captionbelow:
1420 Place the table caption below the table (new in Docutils 0.17).
1421
1422 In addition, the HTML writers process:
1423
1424 :colwidths-auto:
1425 Delegate the determination of table column widths to the back-end
1426 (leave out the ``<colgroup>`` column specification).
1427 Overridden by the "widths" option of the `"table" directive`_.
1428 :colwidths-grid:
1429 Write column widths determined from the source to the HTML file.
1430 Overridden by the "widths" option of the `"table" directive`_.
1431
1432 *Default*: "". *Option*: ``--table-style``.
1433
1434
1435 .. _template [html writers]:
1436
1437 template
1438 ~~~~~~~~
1439 Path [#pwd]_ to template file, which must be encoded in UTF-8.
1440 See also `template [latex writers]`_.
1441
1442 :Default: "template.txt" in the writer's directory (installed automatically)
1443 For the exact machine-specific path, use the ``--help`` option).
1444 :Option: ``--template``.
1445
1446
1447 .. _xml_declaration [html writers]:
1448
1449 xml_declaration
1450 ~~~~~~~~~~~~~~~
1451 Prepend an XML declaration.
1452 See also `xml_declaration [docutils_xml writer]`_.
1453
1454 .. Caution:: The XML declaration carries text encoding information. If the
1455 encoding is not UTF-8 or ASCII and the XML declaration is missing,
1456 standard XML tools may be unable to read the generated XHTML.
1457
1458 :Default: writer dependent.
1459 :Options: ``--xml-declaration``, ``--no-xml-declaration``.
1460
1461
1462 [html4css1 writer]
1463 ~~~~~~~~~~~~~~~~~~
1464 The `HTML4/CSS1 Writer`_ generates output that conforms to the
1465 `XHTML 1 Transitional`_ specification.
1466 It shares all settings defined in the `[html writers]`_
1467 `configuration section`_.
1468
1469
1470 Writer Specific Defaults
1471 """"""""""""""""""""""""
1472 .. class:: run-in narrow
1473
1474 :`initial_header_level`_: 1 (for "<h1>").
1475 :`math_output`_: "HTML math.css".
1476 :`stylesheet_path <stylesheet_path [html writers]_>`__: "html4css1.css".
1477 :`xml_declaration <xml_declaration [html writers]_>`__: True.
1478
1479 .. _HTML4/CSS1 Writer: html.html#html4css1
1480 .. _XHTML 1 Transitional: https://www.w3.org/TR/xhtml1/
1481
1482
1483 field_name_limit
1484 """"""""""""""""
1485 The maximum length (in characters) for one-column `field names`_. Longer
1486 field names will span an entire row of the table used to render the field
1487 list. 0 indicates "no limit". See also option_limit_.
1488
1489 *Default*: 14. *Option*: ``--field-name-limit``.
1490
1491
1492 option_limit
1493 """"""""""""
1494 The maximum length (in characters) for one-column options in `option lists`_.
1495 Longer options will span an entire row of the table used to render
1496 the option list. 0 indicates "no limit".
1497 See also field_name_limit_.
1498
1499 *Default*: 14. *Option*: ``--option-limit``.
1500
1501
1502 [html5 writer]
1503 ~~~~~~~~~~~~~~
1504 The `HTML5 Writer`_ generates valid XML that is compatible with `HTML5`_.
1505 It shares all settings defined in the `[html writers]`_
1506 `configuration section`_.
1507
1508 .. _HTML5 Writer: html.html#html5-polyglot
1509 .. _HTML5: https://www.w3.org/TR/2014/REC-html5-20141028/
1510
1511
1512 Writer Specific Defaults
1513 """"""""""""""""""""""""
1514 .. class:: run-in narrow
1515
1516 :initial_header_level_: 2 (reserve <h1> for the `document title`_). [#]_
1517 :`math_output`_: "MathML" (changed from "HTML math.css"in Docutils 0.22).
1518 :`stylesheet_path <stylesheet_path [html writers]_>`__:
1519 "minimal.css, plain.css".
1520 :`xml_declaration <xml_declaration [html writers]_>`__: False.
1521
1522 .. [#] The default will change to "auto" in Docutils 1.0.
1523
1524 image_loading
1525 """""""""""""
1526 Indicate at which point images should be loaded.
1527
1528 Overridden by the `"loading"`_ option of the `"image"`_ and `"figure"`_
1529 directives.
1530
1531 Supported values:
1532
1533 :embed: Embed still images into the HTML document
1534 (ignored for videos).
1535 :link: Refer to images in the HTML document (default).
1536 :lazy: Refer to images. Additionally specify the
1537 `lazy loading attribute`_ to defer fetching the image.
1538
1539 *Default*: "link". *Option*: ``--image-loading``.
1540
1541 New in Docutils 0.18.
1542
1543 .. _lazy loading attribute: https://html.spec.whatwg.org/multipage/
1544 urls-and-fetching.html#lazy-loading-attributes
1545
1546 section_self_link
1547 """""""""""""""""
1548 Extend section headings with an empty <a> element with a ``href`` to
1549 the section. See ``responsive.css`` for an example how this can be
1550 styled to show a symbol allowing users to copy the section's URL.
1551
1552 :Default: False.
1553 :Options: ``--section-self-link``, ``--no-section-self-link``.
1554
1555 New in Docutils 0.18.
1556
1557
1558 [pep_html writer]
1559 ~~~~~~~~~~~~~~~~~
1560 The PEP/HTML Writer derives from the HTML4/CSS1 Writer, and shares
1561 all settings defined in the `[html writers]`_ and `[html4css1 writer]`_
1562 `configuration sections`_.
1563
1564 Writer Specific Defaults
1565 """"""""""""""""""""""""
1566 .. class:: run-in narrow
1567
1568 :`initial_header_level`_: 1 (for "<h1>").
1569 :`stylesheet_path <stylesheet_path [html writers]_>`__: "pep.css".
1570 :`template <template [html writers]_>`__:
1571 ``docutils/writers/pep_html/template.txt`` in the installation directory.
1572 For the exact machine-specific path, use the ``--help`` option.
1573
1574 no_random
1575 """""""""
1576 Do not use a random banner image. Mainly used to get predictable
1577 results when testing.
1578
1579 *Default*: None (use random banner). *Options*: ``--no-random`` (hidden).
1580
1581 pep_home
1582 """"""""
1583 Home URL prefix for PEPs.
1584
1585 *Default*: "." (current directory). *Option*: ``--pep-home``.
1586
1587 python_home
1588 """""""""""
1589 Python's home URL.
1590
1591 *Default*: "https://www.python.org". *Option*: ``--python-home``.
1592
1593
1594 [s5_html writer]
1595 ~~~~~~~~~~~~~~~~
1596 The S5/HTML Writer derives from the HTML4/CSS1 Writer, and shares
1597 all settings defined in the `[html writers]`_ and `[html4css1 writer]`_
1598 `configuration sections`_.
1599
1600 Writer Specific Defaults
1601 """"""""""""""""""""""""
1602 .. class:: run-in narrow
1603
1604 :compact_lists_: disable compact lists.
1605 :template__: ``docutils/writers/s5_html/template.txt`` in the
1606 installation directory. For the exact machine-specific
1607 path, use the ``--help`` option.
1608
1609 __ `template [html writers]`_
1610
1611
1612 hidden_controls
1613 """""""""""""""
1614 Auto-hide the presentation controls in slideshow mode, or keep
1615 them visible at all times.
1616
1617 :Default: True (auto-hide).
1618 :Options: ``--hidden-controls``, ``--visible-controls``.
1619
1620 current_slide
1621 """""""""""""
1622 Enable or disable the current slide indicator ("1/15").
1623
1624 :Default: None (disabled).
1625 :Options: ``--current-slide``, ``--no-current-slide``.
1626
1627 overwrite_theme_files
1628 """""""""""""""""""""
1629 Allow or prevent the overwriting of existing theme files in the
1630 ``ui/<theme>`` directory. This has no effect if "theme_url_" is
1631 used.
1632
1633 :Default: None (keep existing theme files).
1634 :Options: ``--keep-theme-files``, ``--overwrite-theme-files``.
1635
1636 theme
1637 """""
1638 Name of an installed S5 theme, to be copied into a ``ui/<theme>``
1639 subdirectory, beside the destination file (output HTML). Note
1640 that existing theme files will not be overwritten; the existing
1641 theme directory must be deleted manually.
1642 Overrides also theme_url_. [#override]_
1643
1644 *Default*: "default". *Option*: ``--theme``.
1645
1646 theme_url
1647 """""""""
1648 The URL of an S5 theme directory. The destination file (output
1649 HTML) will link to this theme; nothing will be copied.
1650 Overrides also theme_. [#override]_
1651
1652 *Default*: None. *Option*: ``--theme-url``.
1653
1654 view_mode
1655 """""""""
1656 The initial view mode, either "slideshow" or "outline".
1657
1658 *Default*: "slidewhow". *Option*: ``--view-mode``.
1659
1660
1661
1662 [latex writers]
1663 ----------------
1664
1665 Common settings for the `LaTeX writers`_
1666 `[latex2e writer]`_ and `[xetex writer]`_.
1667
1668 .. _LaTeX writers: latex.html
1669
1670
1671 .. _attribution [latex writers]:
1672
1673 attribution
1674 ~~~~~~~~~~~
1675 Format for `block quote`_ attributions: one of "dash" (em-dash
1676 prefix), "parentheses"/"parens", or "none".
1677 See also `attribution [html writers]`_.
1678
1679 *Default*: "dash". *Option*: ``--attribution``.
1680
1681 compound_enumerators
1682 ~~~~~~~~~~~~~~~~~~~~
1683 Enable or disable compound enumerators for nested `enumerated lists`_
1684 (e.g. "1.2.a.ii").
1685
1686 :Default: None (disabled).
1687 :Options: ``--compound-enumerators``, ``--no-compound-enumerators``.
1688
1689 documentclass
1690 ~~~~~~~~~~~~~
1691 Specify LaTeX documentclass.
1692
1693 *Default*: "article". *Option*: ``--documentclass``.
1694
1695 documentoptions
1696 ~~~~~~~~~~~~~~~
1697 Specify document options. Multiple options can be given, separated by
1698 commas.
1699
1700 *Default*: "a4paper". *Option*: ``--documentoptions``.
1701
1702
1703 .. _embed_stylesheet [latex writers]:
1704
1705 embed_stylesheet
1706 ~~~~~~~~~~~~~~~~
1707 Embed the stylesheet(s) in the header of the output file. The
1708 stylesheets must be accessible during processing. Currently, this
1709 fails if the file is not available via the given path (i.e. the
1710 file is *not* searched in the `TeX input path`_).
1711 See also `embed_stylesheet [html writers]`_.
1712
1713 :Default: False (link to stylesheet).
1714 :Options: ``--embed-stylesheet``, ``--link-stylesheet``.
1715
1716
1717 .. _footnote_references [latex writers]:
1718
1719 footnote_references
1720 ~~~~~~~~~~~~~~~~~~~
1721 Format for `footnote references`_: one of "superscript" or "brackets".
1722
1723 Ignored if latex_footnotes_ is True.
1724 Sets the default for trim_footnote_reference_space_.
1725 See also `footnote_references [html writers]`_.
1726
1727 *Default*: "superscript". *Option*: ``--footnote-references``.
1728
1729
1730 graphicx_option
1731 ~~~~~~~~~~~~~~~
1732 LaTeX graphicx package option.
1733
1734 Possible values are "dvips", "pdftex", "dvipdfmx".
1735
1736 *Default*: "". *Option*: ``--graphicx-option``.
1737
1738 hyperlink_color
1739 ~~~~~~~~~~~~~~~
1740 Color of any hyperlinks embedded in text.
1741
1742 Special values:
1743
1744 .. class:: run-in narrow
1745
1746 :"0" or "false": disables coloring of links
1747 (links will be marked by red boxes that are not printed).
1748 :"black": results in “invisible“ links.
1749
1750 Set hyperref_options_ to "draft" to completely disable hyperlinking.
1751
1752 *Default*: "blue". *Option*: ``--hyperlink-color``.
1753
1754 hyperref_options
1755 ~~~~~~~~~~~~~~~~
1756 Options for the `hyperref TeX package`_.
1757
1758 If hyperlink_color_ is not "false", the expansion of ::
1759
1760 'colorlinks=true,linkcolor=%s,urlcolor=%s' % (
1761 hyperlink_color, hyperlink_color)
1762
1763 is prepended.
1764
1765 *Default*: "". *Option*: ``--hyperref-options``.
1766
1767 .. _hyperref TeX package: https://ctan.org/pkg/hyperref/
1768
1769
1770 .. _docutils_footnotes:
1771
1772 latex_footnotes
1773 ~~~~~~~~~~~~~~~
1774
1775 Let LaTeX handle the numbering and placement of
1776 footnotes_ and `footnote references`_.
1777 For details, see "`how to configure the footnotes`_"
1778 in `Generating LaTeX with Docutils`.
1779
1780 :Default: False (use footnote numbers/symbols appointed by Docutils).
1781 :Options: ``--latex-footnotes``, ``--docutils-footnotes``.
1782
1783 New in Docutils 0.23. Replaces `docutils_footnotes`.
1784
1785
1786 latex_preamble
1787 ~~~~~~~~~~~~~~
1788 LaTeX code that will be inserted in the document preamble.
1789 Can be used to load packages with options or (re-) define LaTeX
1790 macros without writing a custom style file.
1791
1792 :Default: writer dependent (see `[latex2e writer]`_, `[xetex writer]`_).
1793 :Option: ``--latex-preamble``.
1794
1795
1796 legacy_class_functions
1797 ~~~~~~~~~~~~~~~~~~~~~~
1798 Use legacy functions ``\DUtitle`` and ``\DUadmonition`` with a
1799 comma-separated list of class values as optional argument. If `False`, class
1800 values are handled with wrappers and admonitions use the ``DUadmonition``
1801 environment. See `Generating LaTeX with Docutils`__ for details.
1802
1803 :Default: False (default changed in Docutils 0.18).
1804 :Options: ``--legacy-class-functions``, ``--new-class-functions``.
1805
1806 New in Docutils 0.17
1807
1808 __ latex.html#classes
1809
1810
1811 legacy_column_widths
1812 ~~~~~~~~~~~~~~~~~~~~
1813 Use "legacy algorithm" to determine table column widths (for backwards
1814 compatibility).
1815
1816 The new algorithm limits the table width to the text width or specified
1817 table width and keeps the ratio of specified column widths.
1818
1819 Custom table and/or column widths can be set with the respective options
1820 of the `"table" directive`_. See also `Generating LaTeX with Docutils`__.
1821
1822 :Default: True (will change to False in Docutils 1.0).
1823 :Options: ``--legacy-column-widths``, ``--new-column-widths``.
1824
1825 New in Docutils 0.18.
1826
1827 __ latex.html#table-width
1828
1829
1830 literal_block_env
1831 ~~~~~~~~~~~~~~~~~
1832 Environment for `literal blocks`_. Used when the block does not contain
1833 inline elements. [#]_
1834
1835 The values "lstlisting", "listing", "verbatim", "Verbatim", and
1836 "verbatimtab" work out of the box; required LaTeX package are
1837 automatically loaded.
1838
1839 :Default: "" (use "alltt" with quoting of whitespace and special chars).
1840 :Option: ``--literal-block-env``.
1841
1842 .. [#] A <literal-block> element originating from a `"parsed-literal"`_ or
1843 `"code"`_ directive may contain inline elements. LaTeX' verbatim-like
1844 environments cannot be used in this case.
1845
1846
1847 reference_label
1848 ~~~~~~~~~~~~~~~
1849 Per default the LaTeX writer uses ``\hyperref`` for `hyperlink
1850 references`_ to internal__ or `implicit targets`_.
1851 Specify an alternative reference command name, e.g., "ref" or "pageref"
1852 to get the section number or the page number as reference text.
1853
1854 .. Caution::
1855 * Drops the original reference text.
1856 * Experimental. Not sufficiently tested.
1857 * Fails, e.g., with section numbering by Docutils (cf. sectnum_xform_)
1858 or tables without caption.
1859
1860 .. admonition:: Provisional
1861
1862 To be replaced by a dedicated `interpreted text role`_ for references
1863 (cf. TODO__).
1864
1865 *Default*: "" (use ``\hyperref``). *Option*: ``--reference-label``.
1866
1867 __ ../ref/rst/restructuredtext.html#internal-hyperlink-targets
1868 __ ../dev/todo.html#object-numbering-and-object-references
1869
1870 section_enumerator_separator
1871 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1872 The separator between section number prefix and enumerator for
1873 compound enumerated lists (see `compound_enumerators`_).
1874
1875 Generally it isn't recommended to use both, numbered sub-sections and
1876 nested enumerated lists with compound enumerators. This setting avoids
1877 ambiguity in the situation where a section "1" has a list item
1878 enumerated "1.1", and subsection "1.1" has list item "1". With a
1879 separator of ".", these both would translate into a final compound
1880 enumerator of "1.1.1". With a separator of "-", we get the
1881 unambiguous "1-1.1" and "1.1-1".
1882
1883 *Default*: "-". *Option*: ``--section-enumerator-separator``.
1884
1885 section_prefix_for_enumerators
1886 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1887 Enable or disable section ("." subsection ...) prefixes for
1888 compound enumerators. This has no effect unless
1889 `compound_enumerators`_ are enabled.
1890
1891 :Default: None (disabled).
1892 :Options: ``--section-prefix-for-enumerators``,
1893 ``--no-section-prefix-for-enumerators``.
1894
1895
1896 .. _stylesheet [latex writers]:
1897
1898 stylesheet
1899 ~~~~~~~~~~
1900 Comma-separated_ list of style files (LaTeX packages). Used verbatim
1901 (under Windows, path separators are normalized to forward slashes).
1902 Overrides also stylesheet_path__. [#override]_
1903 See also `stylesheet [html writers]`_.
1904
1905 If `embed_stylesheet`__ is False (default), the stylesheet files are
1906 referenced with ``\usepackage`` (values with extension ``.sty`` or no
1907 extension) or ``\input`` (any other extension).
1908 LaTeX will search the specified files in the `TeX input path`_.
1909
1910 Some values change the behaviour of the LaTeX writer:
1911
1912 :docutils: If the `"docutils" package`_ is listed, fallback definitions
1913 for `Docutils specific LaTeX macros`_ are loaded from there
1914 instead of literal inclusion in the output document.
1915 :svg: If the `"svg" package`_ is listed, SVG images_ are
1916 included with the ``\includesvg`` command instead of
1917 the default ``\includegraphics`` (new in Docutils 0.22).
1918
1919 *Default*: empty list. *Option*: ``--stylesheet``.
1920
1921 __ `stylesheet_path [latex writers]`_
1922 __ `embed_stylesheet [latex writers]`_
1923 .. _TeX input path: https://texfaq.org/FAQ-tds
1924 .. _"docutils" package: https://ctan.org/pkg/docutils
1925 .. _Docutils specific LaTeX macros: latex.html#docutils-specific-latex-macros
1926 .. _"svg" package: https://ctan.org/pkg/svg
1927
1928
1929 .. _stylesheet_dirs [latex writers]:
1930
1931 stylesheet_dirs
1932 ~~~~~~~~~~~~~~~
1933 List of directories where stylesheets can be found (comma-separated_).
1934 Used by the stylesheet_path__ setting.
1935
1936 Note: This setting defines a "search path" (similar to the PATH variable
1937 for executables). However, the term "path" is already used in the
1938 stylesheet_path__ setting with the meaning of a file location.
1939
1940 :Default: the working directory of the process at launch.
1941 :Option: ``--stylesheet-dirs``.
1942
1943 __
1944 __ `stylesheet_path [latex writers]`_
1945
1946
1947 .. _stylesheet_path [latex writers]:
1948
1949 stylesheet_path
1950 ~~~~~~~~~~~~~~~
1951 List of style files (comma-separated_). Relative paths are expanded if a
1952 matching file is found in the stylesheet_dirs__.
1953 If embed_stylesheet__ is False, paths are rewritten relative to
1954 the output_path_ (if specified) or the current work directory.
1955 Overrides also stylesheet__. [#override]_
1956 See also `stylesheet_path [html writers]`_.
1957
1958 For files in the `TeX input path`_, the stylesheet__ option is recommended.
1959
1960 *Default*: empty list. *Option*: ``--stylesheet-path``.
1961
1962 __ `stylesheet_dirs [latex writers]`_
1963 __ `embed_stylesheet [latex writers]`_
1964 __
1965 __ `stylesheet [latex writers]`_
1966
1967
1968 .. _table_style [latex writers]:
1969
1970 table_style
1971 ~~~~~~~~~~~
1972 Specify the default style for tables_.
1973 See also `table_style [html writers]`_.
1974
1975 Supported values: "booktabs", "borderless", "colwidths-auto", and "standard".
1976 See `Generating LaTeX with Docutils`__ for details.
1977
1978 *Default*: "standard". *Option*: ``--table-style``.
1979
1980 __ latex.html#table-style
1981
1982
1983 .. _template [latex writers]:
1984
1985 template
1986 ~~~~~~~~
1987
1988 Path [#pwd]_ to a template file, which must be encoded in UTF-8.
1989 See also `template [html writers]`_.
1990
1991 Relative paths are searched in the working directory and the "latex2e"
1992 writer directory.
1993 Docutils provides the template files default.tex_, titlepage.tex_,
1994 titlingpage.tex_, and xelatex.tex_.
1995 The output document is generated from the template by
1996 substituting placeholders with the corresponding parts__
1997 using `string.Template`_.substitute().
1998
1999 __ ../api/publisher.html#parts-provided-by-the-latex-writers
2000 .. _string.Template:
2001 https://docs.python.org/3/library/string.html#template-strings
2002 .. _default.tex: ../../docutils/writers/latex2e/default.tex
2003 .. _titlepage.tex: ../../docutils/writers/latex2e/titlepage.tex
2004 .. _titlingpage.tex: ../../docutils/writers/latex2e/titlingpage.tex
2005 .. _xelatex.tex: ../../docutils/writers/latex2e/xelatex.tex
2006
2007
2008 :Default: writer dependent (see `[latex2e writer]`_, `[xetex writer]`_).
2009 :Option: ``--template``.
2010
2011 use_bibtex
2012 ~~~~~~~~~~
2013
2014 List of style and database(s) for the experimental `BibTeX`_ support
2015 (comma-separated_). Example::
2016
2017 --use-bibtex=unsrt,mydb1,mydb2
2018
2019 .. admonition:: Provisional
2020
2021 Name, values, and behaviour may change in future versions or the
2022 option may be removed.
2023
2024 *Default*: empty list (don't use BibTeX). *Option* ``--use-bibtex``.
2025
2026 .. _BibTeX: https://www.ctan.org/pkg/bibtex
2027
2028 use_latex_abstract
2029 ~~~~~~~~~~~~~~~~~~
2030 Use LaTeX abstract environment for the document's abstract_.
2031
2032 *Default*: False.
2033 *Options*: ``--use-latex-abstract``, ``--topic-abstract``.
2034
2035 use_latex_citations
2036 ~~~~~~~~~~~~~~~~~~~
2037 Use ``\cite`` for citations_.
2038
2039 :Default: False (use simulation with figure-floats).
2040 The default will change in Docutils 1.0.
2041 :Options: ``--use-latex-citations``, ``--figure-citations``.
2042
2043 use_latex_docinfo
2044 ~~~~~~~~~~~~~~~~~
2045 Attach the content of the `bibliographic fields`_ "Author", "Authors",
2046 "Address", "Contact", "Organization", and "Date" to the `document
2047 title`__.
2048
2049 :Default: False (keep date and author info in the `document info`__ table).
2050 :Options: ``--use-latex-docinfo``, ``--use-docutils-docinfo``.
2051
2052 __ latex.html#document-title
2053 __ latex.html#document-info
2054
2055
2056 use_latex_toc
2057 ~~~~~~~~~~~~~
2058 Let LaTeX generate the `table of contents`_. Generates a ToC with page numbers.
2059 Usually LaTeX must be run twice to get the numbers correct.
2060
2061 *Default*: True. *Options*: ``--use-latex-toc``, ``--use-docutils-toc``.
2062
2063 use_part_section
2064 ~~~~~~~~~~~~~~~~
2065 Add parts on top of the section hierarchy.
2066
2067 *Default*: False. *Option*: ``--use-part-section``.
2068
2069 [latex2e writer]
2070 ~~~~~~~~~~~~~~~~
2071 The `LaTeX2e writer`_ generates a LaTeX source suited for compilation
2072 with 8-bit LaTeX (pdfTeX_). It shares all settings defined in the `[latex
2073 writers]`_ `configuration section`_.
2074
2075 .. _LaTeX2e writer: latex.html#latex2e-writer
2076 .. _pdfTeX: https://www.tug.org/applications/pdftex/
2077
2078
2079 Writer Specific Defaults
2080 """"""""""""""""""""""""
2081 .. class:: run-in narrow
2082
2083 :latex_preamble_: Load the "PDF standard fonts" (Times, Helvetica, Courier)::
2084
2085 \usepackage{mathptmx} % Times
2086 \usepackage[scaled=.90]{helvet}
2087 \usepackage{courier}
2088
2089 :template__:
2090 default.tex_.
2091
2092 __ `template [latex writers]`_
2093
2094
2095 font_encoding
2096 """""""""""""
2097 String with `LaTeX font encoding`_. Multiple encodings can be specified
2098 separated by commas. The last value becomes the document default.
2099
2100 *Default*: "T1". *Option*: ``--font-encoding``.
2101
2102 .. _LaTeX font encoding: latex.html#font-encoding
2103
2104
2105 [xetex writer]
2106 ~~~~~~~~~~~~~~
2107 The `XeTeX writer`_ generates a LaTeX source suited for compilation with
2108 `XeTeX or LuaTeX`_. It derives from the latex2e writer, and shares all
2109 settings defined in the `[latex writers]`_ `configuration section`_.
2110
2111 .. _XeTeX writer: latex.html#xetex-writer
2112 .. _XeTeX or LuaTeX: https://texfaq.org/FAQ-xetex-luatex
2113
2114 Writer Specific Defaults
2115 """"""""""""""""""""""""
2116 .. class:: run-in narrow
2117
2118 :latex_preamble_: Font setup for `Linux Libertine`_,::
2119
2120 % Linux Libertine (free, wide coverage, not only for Linux)
2121 \setmainfont{Linux Libertine O}
2122 \setsansfont{Linux Biolinum O}
2123 \setmonofont[HyphenChar=None]{DejaVu Sans Mono}
2124
2125 The optional argument ``HyphenChar=None`` to the monospace font
2126 prevents word hyphenation in literal text.
2127
2128 :template__: xelatex.tex_.
2129
2130 .. _Linux Libertine: https://www.linuxlibertine.org/
2131 __ `template [latex writers]`_
2132
2133
2134 [manpage writer]
2135 ----------------
2136
2137 The `manpage writer`_ generates documents in the roff_ markup language
2138 for processing into UNIX `manual pages`_ with, e.g., mandoc_ or groff_.
2139
2140 .. _manpage Writer: manpage.html
2141 .. _roff: https://en.wikipedia.org/wiki/Roff_(software)
2142 .. _manual pages: https://en.wikipedia.org/wiki/Man_page
2143 .. _mandoc: http://mandoc.bsd.lv/
2144 .. _groff: https://gnu.org/software/groff/
2145
2146 text_references
2147 ~~~~~~~~~~~~~~~~
2148
2149 Use a text rendering instead of the macros ``UR`` and ``MT`` for
2150 reference targets (URI references and email addresses).
2151 Some systems (e.g. Solaris troff) do not support these macros.
2152 Text references also prevent problems when groff_ is used on a
2153 terminal emulator that does not `support OSC8 sequences`__
2154 (alternatively, call groff_ with the option `-rU0`__).
2155
2156 :Default: True (will change to False in Docutils 1.0).
2157 :Options: ``--macro-references``, ``--text-references``.
2158
2159 __ https://github.com/Alhadis/OSC8-Adoption/
2160 __ https://www.man7.org/linux/man-pages/man7/groff_man.7.html#Options
2161
2162
2163 .. _ODF/ODT Writer:
2164
2165 [odf_odt writer]
2166 ----------------
2167
2168 The ODF/`ODT Writer`_ generates documents in the
2169 OpenDocument_ Text format (.odt).
2170
2171 The output_encoding_ setting is ignored, the output encoding is
2172 always "UTF-8".
2173
2174 .. _ODT Writer: odt.html
2175 .. _OpenDocument: https://en.wikipedia.org/wiki/OpenDocument
2176
2177 add-syntax_highlighting
2178 ~~~~~~~~~~~~~~~~~~~~~~~
2179 Add syntax highlighting in literal code blocks.
2180 See section "`Syntax highlighting`__" in the ODT Writer documentation
2181 for details.
2182
2183 :Default: False.
2184 :Options: ``--add-syntax-highlighting``, ``--no-syntax-highlighting``.
2185
2186 __ odt.html#syntax-highlighting
2187
2188 create_links
2189 ~~~~~~~~~~~~
2190 Create links.
2191
2192 *Default*: False.
2193 *Options*: ``--create-links``, ``--no-links``.
2194
2195 create_sections
2196 ~~~~~~~~~~~~~~~
2197 Create sections for headers.
2198
2199 :Default: True.
2200 :Options: ``--create-sections``, ``--no-sections``.
2201
2202 cloak_email_addresses
2203 ~~~~~~~~~~~~~~~~~~~~~
2204 Obfuscate email addresses to confuse harvesters while still
2205 keeping email links usable with standards-compliant browsers.
2206
2207 :Default: False.
2208 :Options: ``--cloak-email-addresses``, ``--no-cloak-email-addresses``.
2209
2210 custom_header
2211 ~~~~~~~~~~~~~
2212 Specify the contents of a custom header line.
2213 See section "`Custom header/footers`_" in the ODT Writer documentation
2214 for details.
2215
2216 *Default*: "" (no header).
2217 *Option*: ``--custom-odt-header``.
2218
2219 custom_footer
2220 ~~~~~~~~~~~~~
2221 Specify the contents of a custom footer line.
2222 See section "`Custom header/footers`_" in the ODT Writer documentation
2223 for details.
2224
2225 *Default*: "" (no footer).
2226 *Option*: ``--custom-odt-footer``.
2227
2228 .. _custom header/footers:
2229 odt.html#custom-header-footers-inserting-page-numbers-date-time-etc
2230
2231 endnotes_end_doc
2232 ~~~~~~~~~~~~~~~~
2233 Generate endnotes at end of document, not footnotes at bottom of page.
2234
2235 :Default: False.
2236 :Options: ``--endnotes-end-doc``, ``--no-endnotes-end-doc``.
2237
2238 generate_oowriter_toc
2239 ~~~~~~~~~~~~~~~~~~~~~
2240 Generate a native ODF table of contents, not a bullet list.
2241 See section "`Table of contents`__" in the ODT Writer documentation
2242 for details.
2243
2244 :Default: True.
2245 :Options: ``--generate-oowriter-toc``, ``--generate-list-toc``.
2246
2247 __ odt.html#table-of-contents
2248
2249 odf_config_file
2250 ~~~~~~~~~~~~~~~
2251 Path [#pwd]_ to a configuration/mapping file for additional ODF options.
2252 In particular, this file may contain a mapping of default style names to
2253 names used in the resulting output file.
2254 See section `How to use custom style names`__ in the
2255 ODT Writer documentation for details.
2256
2257 *Default*: None.
2258 *Option*: ``--odf-config-file``.
2259
2260 __ odt.html#how-to-use-custom-style-names
2261
2262 stylesheet
2263 ~~~~~~~~~~
2264 Path [#pwd]_ to a style file. See section `Styles and Classes`_
2265 in the ODT Writer documentation for details.
2266
2267 :Default: "writers/odf_odt/styles.odt" in the installation directory.
2268 :Option: ``--stylesheet``.
2269
2270 .. _styles and classes: odt.html#styles-and-classes
2271
2272 table_border_thickness
2273 ~~~~~~~~~~~~~~~~~~~~~~
2274 Specify the thickness of table borders in thousands of a centimetre.
2275 The `Table styles`__ section in the ODT Writer documentation describes
2276 alternatives for additional customisation of the table style.
2277
2278 *Default*: 35 (0.35 mm).
2279 *Option*: ``--table-border-thickness``.
2280
2281 __ odt.html#table-styles
2282
2283
2284 [pseudoxml writer]
2285 ------------------
2286
2287 detailed
2288 ~~~~~~~~~
2289 Pretty-print <#text> nodes.
2290
2291 *Default*: False. *Option*: ``--detailed``.
2292
2293
2294 [applications]
2295 ==============
2296
2297 The following applications (`front-end tools`_) provide additional settings.
2298
2299
2300 .. _buildhtml:
2301
2302 [buildhtml application]
2303 -----------------------
2304
2305 buildhtml.py_ generates HTML documents from reStructuredText source
2306 files in a set of directories and their subdirectories.
2307 All visited directories are scanned for "docutils.conf" files which are
2308 parsed after the standard configuration files. Path settings [#pwd]_ in
2309 these files are resolved relative to the respective directory.
2310
2311 The output_path_ setting is ignored.
2312
2313 dry_run
2314 ~~~~~~~
2315 Do not process files, show files that would be processed.
2316
2317 *Default*: False (process files). *Option*: ``--dry-run``.
2318
2319 ignore
2320 ~~~~~~
2321 List of glob-style patterns [#globbing]_ (colon-separated_).
2322 Source files with matching filename are silently ignored.
2323 Values are appended. [#append-values]_
2324
2325 *Default*: empty list. *Option*: ``--ignore``.
2326
2327 prune
2328 ~~~~~
2329 List of glob-style patterns [#globbing]_ (colon-separated_).
2330 Matching directories are skipped. Values are appended. [#append-values]_
2331
2332 Patterns are expanded similar to path settings [#pwd]_ and matched
2333 against the absolute path of to-be-processed directories.
2334 Example: a directory is pruned if it contains a "docutils.conf" file
2335 with the lines ::
2336
2337 [buildhtml application]
2338 prune: '.'
2339
2340 The default patterns skip auxiliary directories from Python or
2341 popular version control tools anywhere [#]_.
2342
2343 :Default: ``/*/.hg:/*/.bzr:/*/.git:/*/.svn:/*/.venv:/*/__pycache__``.
2344 :Option: ``--prune``.
2345
2346 .. [#] The leading "/" prevents expansion with `pwd`;
2347 ``fnmatch('/*')`` matches any absolute path.
2348
2349 recurse
2350 ~~~~~~~
2351 Recursively scan subdirectories.
2352
2353 *Default*: True. *Options*: ``--recurse``, ``--local``.
2354
2355 sources
2356 ~~~~~~~
2357 List of glob-style [#globbing]_ patterns (colon-separated_).
2358 Files with matching filename are treated as source documents.
2359 Values in configuration files overwrite the default and are
2360 overwritten by the command line option.
2361
2362 *Default*: ``*.rst:*.rst``. *Option*: ``--rst-sources``.
2363
2364 New in Docutils 0.21.
2365
2366 silent
2367 ~~~~~~
2368 Work silently (no progress messages).
2369 Independent of report_level_.
2370
2371 *Default*: None (show progress). *Option*: ``--silent``.
2372
2373 .. _html_writer:
2374 .. _writer [buildhtml application]:
2375
2376 writer
2377 ~~~~~~
2378 `HTML writer`_ version. One of "html", "html4", "html5".
2379
2380 :Default: "html" (use Docutils' `default HTML writer`_).
2381 :Option: ``--writer``
2382
2383 New in 0.17. Obsoletes the ``html_writer`` option.
2384
2385 .. _HTML writer: html.html
2386 .. _default HTML writer: html.html#html
2387
2388 .. [#globbing] Pattern matching is done with the `fnmatch module`_.
2389 It resembles shell-style globbing, but without special treatment
2390 of path separators and '.' (in contrast__ to the `glob module`_ and
2391 `pathlib.PurePath.match()`_).
2392 For example, "``/*.py``" matches "/a/b/c.py".
2393
2394 Provisional: may use `pathlib.PurePath.match()` once this supports "**".
2395
2396 .. _fnmatch module:
2397 https://docs.python.org/3/library/fnmatch.html#module-fnmatch
2398 .. _glob module:
2399 https://docs.python.org/3/library/glob.html#module-glob
2400 .. _pathlib.PurePath.match():
2401 https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.match
2402 __ https://github.com/python/cpython/issues/106747
2403
2404
2405 [docutils application]
2406 --------------------------
2407
2408 Docutils' `generic front end`_ tool allows combining "reader", "parser",
2409 and "writer" components from the Docutils package or 3rd party plug-ins.
2410
2411 | New in 0.17. Config file support added in 0.18.
2412 | Renamed in 0.19 (the old section name "docutils-cli application"
2413 is kept as alias).
2414 | Support for reader/parser import names added in 0.19.
2415
2416 .. _generic front end: tools.html#generic-command-line-front-end
2417
2418 reader
2419 ~~~~~~
2420 Reader component name.
2421 One of "standalone", "pep", or the import name of a plug-in reader module.
2422
2423 *Default*: "standalone".
2424 *Option*: ``--reader``
2425
2426 parser
2427 ~~~~~~
2428 Parser component name.
2429 Either "`rst <[restructuredtext parser]_>`__", "`xml <[xml parser]_>`__",
2430 or the import name of a plug-in parser module. [#]_
2431
2432 *Default*: "rst".
2433 *Option*: ``--parser``
2434
2435 .. [#] Docutils recognizes the aliases
2436 "`pycmark <[pycmark parser]_>`__", "`myst <[myst parser]_>`__",
2437 and "`recommonmark <[recommonmark parser]_>`__" (deprecated) and selects
2438 the corresponding 3rd-party Markdown parser (if it is installed).
2439 The aliases "markdown" and "commonmark" select the first available
2440 parser from this list.
2441
2442
2443 .. _writer [docutils application]:
2444
2445 writer
2446 ~~~~~~
2447 Writer component name.
2448 One of "html", "html4", "html5", "latex", "xelatex", "odt", "xml",
2449 "pseudoxml", "manpage", "pep_html", "s5", an alias,
2450 or the import name of a plug-in writer module.
2451
2452 *Default*: "html5".
2453 *Option*: ``--writer``
2454
2455
2456 Other Settings
2457 ==============
2458
2459 Command-Line Only
2460 -----------------
2461
2462 These settings are only effective as command-line options; setting
2463 them in configuration files has no effect.
2464
2465 config
2466 ~~~~~~
2467 Path to an additional configuration file.
2468 The file is processed immediately (if it exists) with
2469 settings overriding defaults and earlier settings. [#config-change]_
2470
2471 Filesystem path settings [#pwd]_ contained within the config file will be
2472 interpreted relative to the config file's location (*not* relative to the
2473 current working directory).
2474
2475 Multiple ``--config`` options may be specified;
2476 each will be processed in turn. [#config-change]_
2477
2478 *Default*: None. *Option*: ``--config``.
2479
2480 .. [#config-change] After the `transition to the "argparse" module`__,
2481 files specified with the ``--config`` option will be appended
2482 to the list of `configuration files`_ and evaluated before any
2483 other command line arguments.
2484
2485 __ ../../RELEASE-NOTES.html#command-line-interface
2486
2487 Internal Settings
2488 -----------------
2489
2490 These settings are for internal use only; setting them in
2491 configuration files has no effect, and there are no corresponding
2492 command-line options (except for `_destination`_).
2493
2494 _config_files
2495 ~~~~~~~~~~~~~
2496 List of paths of applied configuration files.
2497
2498 *Default*: None.
2499
2500 _directories
2501 ~~~~~~~~~~~~
2502 Only with the `[buildhtml application]`_.
2503
2504 List of paths to source directories, set from `positional arguments
2505 <tools.html#buildhtml-py>`__.
2506
2507 *Default*: None (current working directory).
2508
2509 _disable_config
2510 ~~~~~~~~~~~~~~~
2511 Prevent standard configuration files from being read.
2512 For command-line use, set the DOCUTILSCONFIG_ variable.
2513
2514 :Default: None (config files enabled).
2515
2516 _destination
2517 ~~~~~~~~~~~~
2518 Path to the output file, set from `positional arguments`_.
2519
2520 Deprecated, obsoleted by the output_path_ setting. Will be removed
2521 in Docutils 2.0 (cf. `Future changes`_ in the RELEASE-NOTES).
2522
2523 *Default*: None (stdout). *Option*: ``--output``.
2524
2525 _source
2526 ~~~~~~~
2527 Path to input source, set from `positional arguments`_.
2528
2529 *Default*: None (stdin).
2530
2531 sectnum_depth
2532 ~~~~~~~~~~~~~
2533 Stores the value of the `"sectnum" directive`_'s "depth" option
2534 if sectnum_xform_ is False.
2535
2536 No default. [#SectNum]_
2537
2538 sectnum_prefix
2539 ~~~~~~~~~~~~~~
2540 Stores the value of the `"sectnum" directive`_'s "prefix" option
2541 if sectnum_xform_ is False.
2542
2543 No default. [#SectNum]_
2544
2545 sectnum_start
2546 ~~~~~~~~~~~~~
2547 Stores the value of the `"sectnum" directive`_'s "start" option
2548 if sectnum_xform_ is False.
2549
2550 No default. [#SectNum]_
2551
2552 sectnum_suffix
2553 ~~~~~~~~~~~~~~
2554 Stores the value of the `"sectnum" directive`_'s "suffix" option
2555 if sectnum_xform_ is False.
2556
2557 No default. [#SectNum]_
2558
2559 --------------------------------------------------------------------------
2560
2561 .. [#override] The overridden setting will automatically be set to
2562 ``None`` for command-line options and config file settings. Client
2563 programs which specify defaults that override other settings must
2564 do the overriding explicitly, by assigning ``None`` to the other
2565 settings.
2566
2567 .. [#append-values] Some settings append values from the various
2568 sources to a list instead of overriding previous values.
2569 The corresponding command line options may be used more than once.
2570
2571 .. [#encodings] Docutils supports all `standard encodings`_ and encodings
2572 registered__ with the codecs_ module.
2573
2574 .. [#pwd] Filesystem path relative to the working directory of the
2575 process at launch.
2576 Exception: Path settings in configuration files specified by the
2577 config_ command line option or in directories visited by the
2578 buildhtml_ application are resolved relative to the directory of
2579 the respective configuration file.
2580
2581 .. [#SectNum] Added by the `SectNum` transform_, if and only if there
2582 is a `"sectnum" directive`_ in the source document.
2583
2584 __ https://docs.python.org/3/library/codecs.html#codecs.register
2585
2586
2587 Appendix
2588 ========
2589
2590 Old-Format Configuration Files
2591 ------------------------------
2592
2593 Formerly, Docutils `configuration files`_ contained a single "[options]"
2594 section only. This was found to be inflexible, and in August 2003
2595 Docutils adopted the current component-based configuration file
2596 sections as described above.
2597 Up to version 2.0, Docutils will still recognize the old "[options]"
2598 section, but complain with a deprecation warning.
2599
2600 To convert existing config files, the easiest way is to change the
2601 section title: change "[options]" to "[general]". Most settings
2602 haven't changed. The only ones to watch out for are these:
2603
2604 ===================== =====================================
2605 Old-Format Setting New Section & Setting
2606 ===================== =====================================
2607 pep_stylesheet [pep_html writer] stylesheet
2608 pep_stylesheet_path [pep_html writer] stylesheet_path
2609 pep_template [pep_html writer] template
2610 ===================== =====================================
2611
2612
2613 .. _auto-detect:
2614
2615 Input Encoding Auto-Detection
2616 -----------------------------
2617
2618 Up to Docutils 0.21, the input_encoding_ default value was ``None`` and
2619 the actual input encoding detected from a `Unicode byte order mark` (BOM_)
2620 or an `encoding declaration`_ in the source.
2621
2622 The default input encoding changed to "utf-8" in Docutils 0.22.
2623 Currently, auto-detection can be selected with an input_encoding_ value
2624 ``None`` (rsp. an empty string in a configuration file).
2625 However, **this feature** is deprecated and **will be removed** in
2626 Docutils 1.0. See the `inspecting_codecs`_ package for a replacement.
2627
2628 Encoding Declaration
2629 ~~~~~~~~~~~~~~~~~~~~
2630
2631 Input encoding auto-detection scans the source for an
2632 *encoding declaration* inspired by :PEP:`263`:
2633
2634 A comment like ::
2635
2636 .. text encoding: <encoding name>
2637
2638 on the first or second line defines `<encoding name>`
2639 as the source's input encoding.
2640
2641 Examples: (using formats recognized by popular editors) ::
2642
2643 .. -*- mode: rst -*-
2644 -*- coding: latin1 -*-
2645
2646 or::
2647
2648 .. vim: set fileencoding=cp737 :
2649
2650 More precisely, the first and second line are searched for the following
2651 regular expression::
2652
2653 coding[:=]\s*([-\w.]+)
2654
2655 The first group of this expression is then interpreted as encoding name.
2656 If the first line matches the second line is ignored.
2657
2658
2659 .. References
2660
2661 .. _Docutils Document Tree:
2662 .. _Docutils Generic document type definition:
2663 .. _Document Tree: ../ref/doctree.html
2664 .. _Doctree: ../ref/doctree.html
2665 .. _class attribute: ../ref/doctree.html#classes
2666 .. _identifiers: ../ref/doctree.html#identifiers
2667 .. _reference name:
2668 .. _reference names: ../ref/doctree.html#reference-names
2669 .. _title attribute: ../ref/doctree.html#title-attribute
2670 .. _"uri" attribute: ../ref/doctree.html#uri
2671
2672 .. _Docutils Runtime Settings:
2673 .. _runtime settings: ../api/runtime-settings.html
2674
2675 .. _Publisher Interface: ../api/publisher.html
2676 .. _publish_string(): ../api/publisher.html#publish-string
2677 .. _publish_from_doctree(): ../api/publisher.html#publish-from-doctree
2678
2679 .. _transform: ../api/transforms.html
2680 .. _DocInfo: ../api/transforms.html#docinfo
2681 .. _DocTitle: ../api/transforms.html#doctitle
2682 .. _SectSubTitle: ../api/transforms.html#sectsubtitle
2683
2684 .. _severity level: ../peps/pep-0258.html#error-handling
2685
2686 .. RestructuredText Directives
2687 .. _"class" directive: ../ref/rst/directives.html#class
2688 .. _"code": ../ref/rst/directives.html#code
2689 .. _"csv-table": ../ref/rst/directives.html#csv-table
2690 .. _"figure": ../ref/rst/directives.html#figure
2691 .. _images:
2692 .. _"image": ../ref/rst/directives.html#image
2693 .. _"include": ../ref/rst/directives.html#include
2694 .. _"loading": ../ref/rst/directives.html#loading
2695 .. _"math" directive: ../ref/rst/directives.html#math
2696 .. _"parsed-literal": ../ref/rst/directives.html#parsed-literal
2697 .. _"raw":
2698 .. _"raw" directive: ../ref/rst/directives.html#raw
2699 .. _"sectnum" directive: ../ref/rst/directives.html#sectnum
2700 .. _"substitution": ../ref/rst/directives.html#substitution
2701 .. _"table" directive: ../ref/rst/directives.html#table
2702 .. _"title" directive: ../ref/rst/directives.html#metadata-document-title
2703 .. _table of contents: ../ref/rst/directives.html#table-of-contents
2704
2705 .. RestructuredText Markup Specification
2706 .. _anonymous hyperlink target:
2707 ../ref/rst/restructuredtext.html#anonymous-hyperlinks
2708 .. _auto-symbol footnotes:
2709 ../ref/rst/restructuredtext.html#auto-symbol-footnotes
2710 .. _abstract:
2711 .. _bibliographic field list:
2712 .. _bibliographic fields:
2713 ../ref/rst/restructuredtext.html#bibliographic-fields
2714 .. _block quote: ../ref/rst/restructuredtext.html#block-quotes
2715 .. _bullet lists: ../ref/rst/restructuredtext.html#bullet-lists
2716 .. _citations: ../ref/rst/restructuredtext.html#citations
2717 .. _document title: ../ref/rst/restructuredtext.html#document-title
2718 .. _enumerated lists: ../ref/rst/restructuredtext.html#enumerated-lists
2719 .. _explicit target: ../ref/rst/restructuredtext.html#explicit-hyperlink-targets
2720 .. _field lists: ../ref/rst/restructuredtext.html#field-lists
2721 .. _field names: ../ref/rst/restructuredtext.html#field-names
2722 .. _footnotes: ../ref/rst/restructuredtext.html#footnotes
2723 .. _footnote references: ../ref/rst/restructuredtext.html#footnote-references
2724 .. _hyperlink references: ../ref/rst/restructuredtext.html#hyperlink-references
2725 .. _implicit target:
2726 .. _implicit targets: ../ref/rst/restructuredtext.html#implicit-hyperlink-targets
2727 .. _interpreted text role: ../ref/rst/restructuredtext.html#interpreted-text
2728 .. _inline markup recognition rules:
2729 ../ref/rst/restructuredtext.html#inline-markup-recognition-rules
2730 .. _literal blocks: ../ref/rst/restructuredtext.html#literal-blocks
2731 .. _option lists: ../ref/rst/restructuredtext.html#option-lists
2732 .. _tables: ../ref/rst/restructuredtext.html#tables
2733
2734 .. _Docutils HTML writers: html.html
2735
2736 .. _How to configure the footnotes: latex.html#footnotes
2737
2738 .. _application:
2739 .. _front-end tool:
2740 .. _front-end tools: tools.html
2741 .. _buildhtml.py: tools.html#buildhtml-py
2742 .. _positional argument:
2743 .. _positional arguments: tools.html#usage-pattern
2744
2745 .. _Future changes: ../../RELEASE-NOTES.html#future-changes
2746
2747 .. _BCP 47: https://www.rfc-editor.org/rfc/bcp/bcp47.txt
2748 .. _Error Handlers:
2749 https://docs.python.org/3/library/codecs.html#error-handlers
2750 .. _ISO 639: https://www.loc.gov/standards/iso639-2/php/English_list.php
2751 .. _ISO 3166: https://www.iso.org/iso-3166-country-codes.html
2752 .. _language tag: https://www.w3.org/International/articles/language-tags/
2753
2754 .. _codecs: https://docs.python.org/3/library/codecs.html
2755 .. _standard encodings:
2756 https://docs.python.org/3/library/codecs.html#standard-encodings
2757 .. _BOM: https://docs.python.org/3/library/codecs.html#codecs.BOM
2758 .. _inspecting_codecs: https://codeberg.org/milde/inspecting-codecs