.. include:: ../../header2.txt
=======================================
reStructuredText Markup Specification
=======================================
:Author: David Goodger
:Contact: docutils-develop@lists.sourceforge.net
:Revision: $Revision: 9616 $
:Date: $Date: 2024-04-07 15:17:23 +0200 (So, 07. Apr 2024) $
:Copyright: This document has been placed in the public domain.
.. Note::
This document is a detailed technical specification; it is not a
tutorial or a primer. If this is your first exposure to
reStructuredText, please read `A ReStructuredText Primer`_ and the
`Quick reStructuredText`_ user reference first.
.. _A ReStructuredText Primer: ../../user/rst/quickstart.html
.. _Quick reStructuredText: ../../user/rst/quickref.html
reStructuredText_ is plaintext that uses simple and intuitive
constructs to indicate the structure of a document. These constructs
are equally easy to read in raw and processed forms. This document is
itself an example of reStructuredText (raw, if you are reading the
`text file`__, or processed, if you are reading an HTML document, for
example). The reStructuredText parser is a component of Docutils_.
Simple, implicit markup is used to indicate special constructs, such
as section headings, bullet lists, and emphasis. The markup used is
as minimal and unobtrusive as possible. Less often-used constructs
and extensions to the basic reStructuredText syntax may have more
elaborate or explicit markup.
reStructuredText is applicable to documents of any length, from the
very small (such as inline program documentation fragments, e.g.
Python docstrings) to the quite large (this document).
The first section gives a quick overview of the syntax of the
reStructuredText markup by example. A complete specification is given
in the `Syntax Details`_ section.
`Literal blocks`_ (in which no markup processing is done) are used for
examples throughout this document, to illustrate the plaintext markup.
__ restructuredtext.txt
.. contents::
-----------------------
Quick Syntax Overview
-----------------------
A reStructuredText document is made up of body or block-level
elements, and may be structured into sections. Sections_ are
indicated through title style (underlines & optional overlines).
Sections contain body elements and/or subsections. Some body elements
contain further elements, such as lists containing list items, which
in turn may contain paragraphs and other body elements. Others, such
as paragraphs, contain text and `inline markup`_ elements.
Here are examples of `body elements`_:
- Paragraphs_ (and `inline markup`_)::
Paragraphs contain text and may contain inline markup:
*emphasis*, **strong emphasis**, `interpreted text`, ``inline
literals``, standalone hyperlinks (https://www.python.org),
external hyperlinks (Python_), internal cross-references
(example_), footnote references ([1]_), citation references
([CIT2002]_), substitution references (|example|), and _`inline
internal targets`.
Paragraphs are separated by blank lines and are left-aligned.
- Five types of lists:
1. `Bullet lists`_::
- This is a bullet list.
- Bullets can be "*", "+", or "-".
2. `Enumerated lists`_::
1. This is an enumerated list.
2. Enumerators may be arabic numbers, letters, or roman
numerals.
3. `Definition lists`_::
what
Definition lists associate a term with a definition.
how
The term is a one-line phrase, and the definition is one
or more paragraphs or body elements, indented relative to
the term.
4. `Field lists`_::
:what: Field lists map field names to field bodies, like
database records. They are often part of an extension
syntax.
:how: The field marker is a colon, the field name, and a
colon.
The field body may contain one or more body elements,
indented relative to the field marker.
5. `Option lists`_, for listing command-line options::
-a command-line option "a"
-b file options can have arguments
and long descriptions
--long options can be long also
--input=file long options can also have
arguments
/V DOS/VMS-style options too
There must be at least two spaces between the option and the
description.
- `Literal blocks`_::
Literal blocks are either indented or line-prefix-quoted blocks,
and indicated with a double-colon ("::") at the end of the
preceding paragraph (right here -->)::
if literal_block:
text = 'is left as-is'
spaces_and_linebreaks = 'are preserved'
markup_processing = None
- `Block quotes`_::
Block quotes consist of indented body elements:
This theory, that is mine, is mine.
-- Anne Elk (Miss)
- `Doctest blocks`_::
>>> print 'Python-specific usage examples; begun with ">>>"'
Python-specific usage examples; begun with ">>>"
>>> print '(cut and pasted from interactive Python sessions)'
(cut and pasted from interactive Python sessions)
- Two syntaxes for tables_:
1. `Grid tables`_; complete, but complex and verbose::
+------------------------+------------+----------+
| Header row, column 1 | Header 2 | Header 3 |
+========================+============+==========+
| body row 1, column 1 | column 2 | column 3 |
+------------------------+------------+----------+
| body row 2 | Cells may span |
+------------------------+-----------------------+
2. `Simple tables`_; easy and compact, but limited::
==================== ========== ==========
Header row, column 1 Header 2 Header 3
==================== ========== ==========
body row 1, column 1 column 2 column 3
body row 2 Cells may span columns
==================== ======================
- `Explicit markup blocks`_ all begin with an explicit block marker,
two periods and a space:
- Footnotes_::
.. [1] A footnote contains body elements, consistently
indented by at least 3 spaces.
- Citations_::
.. [CIT2002] Just like a footnote, except the label is
textual.
- `Hyperlink targets`_::
.. _Python: https://www.python.org
.. _example:
The "_example" target above points to this paragraph.
- Directives_::
.. image:: mylogo.png
- `Substitution definitions`_::
.. |symbol here| image:: symbol.png
- Comments_::
.. Comments begin with two dots and a space. Anything may
follow, except for the syntax of footnotes/citations,
hyperlink targets, directives, or substitution definitions.
----------------
Syntax Details
----------------
Descriptions below list "doctree elements" (document tree element
names; XML DTD generic identifiers) corresponding to syntax
constructs. For details on the hierarchy of elements, please see `The
Docutils Document Tree`_ and the `Docutils Generic DTD`_ XML document
type definition.
Whitespace
==========
:Config setting: tab_width_
Spaces are recommended for indentation_, but tabs may also be used.
Tabs will be converted to spaces. Tab stops are at every 8th column
(processing systems may make this value configurable, Docutils uses the
`tab_width`_ configuration setting).
Other whitespace characters (form feeds [chr(12)] and vertical tabs
[chr(11)]) are converted to single spaces before processing.
Blank Lines
-----------
Blank lines are used to separate paragraphs and other elements.
Multiple successive blank lines are equivalent to a single blank line,
except within literal blocks (where all whitespace is preserved).
Blank lines may be omitted when the markup makes element separation
unambiguous, in conjunction with indentation. The first line of a
document is treated as if it is preceded by a blank line, and the last
line of a document is treated as if it is followed by a blank line.
Indentation
-----------
Indentation is used to indicate -- and is only significant in
indicating -- block quotes, definitions (in `definition lists`_),
and local nested content:
- list item content (multi-line contents of list items, and multiple
body elements within a list item, including nested lists),
- the content of `literal blocks`_, and
- the content of `explicit markup blocks`_ (directives, footnotes, ...).
Any text whose indentation is less than that of the current level
(i.e., unindented text or "dedents") ends the current level of
indentation.
Since all indentation is significant, the level of indentation must be
consistent. For example, indentation is the sole markup indicator for
`block quotes`_::
This is a top-level paragraph.
This paragraph belongs to a first-level block quote.
Paragraph 2 of the first-level block quote.
Multiple levels of indentation within a block quote will result in
more complex structures::
This is a top-level paragraph.
This paragraph belongs to a first-level block quote.
This paragraph belongs to a second-level block quote.
Another top-level paragraph.
This paragraph belongs to a second-level block quote.
This paragraph belongs to a first-level block quote. The
second-level block quote above is inside this first-level
block quote.
When a paragraph or other construct consists of more than one line of
text, the lines must be left-aligned::
This is a paragraph. The lines of
this paragraph are aligned at the left.
This paragraph has problems. The
lines are not left-aligned. In addition
to potential misinterpretation, warning
and/or error messages will be generated
by the parser.
Several constructs begin with a marker, and the body of the construct
must be indented relative to the marker. For constructs using simple
markers (`bullet lists`_, `enumerated lists`_), the level of
indentation of the body is determined by the position of the first
line of text. For example::
- This is the first line of a bullet list
item's paragraph. All lines must align
relative to the first line.
This indented paragraph is interpreted
as a block quote.
Another paragraph belonging to the first list item.
Because it is not sufficiently indented,
this paragraph does not belong to the list
item (it's a block quote following the list).
The body of `explicit markup blocks`_, `field lists`_, and `option
lists`_ ends above the first line with the same or less indentation
than the marker. For example, field lists may have very long markers
(containing the field names)::
:Hello: This field has a short field name, so aligning the field
body with the first line is feasible.
:Number-of-African-swallows-required-to-carry-a-coconut: It would
be very difficult to align the field body with the left edge
of the first line. It may even be preferable not to begin the
body on the same line as the marker.
.. _escape:
Escaping Mechanism
==================
The character set universally available to plaintext documents, 7-bit
ASCII, is limited. No matter what characters are used for markup,
they will already have multiple meanings in written text. Therefore
markup characters will sometimes appear in text without being
intended as markup. Any serious markup system requires an escaping
mechanism to override the default meaning of the characters used for
the markup. In reStructuredText we use the *backslash*, commonly used
as an escaping character in other domains.
A backslash (``\``) escapes the following character.
* "Escaping" backslash characters are represented by NULL characters in
the `Document Tree`_ and removed from the output document by the
Docutils writers_.
* Escaped non-white characters are prevented from playing a role in any
markup interpretation. The escaped character represents the character
itself. (A literal backslash can be specified by two backslashes in a
row -- the first backslash escapes the second. [#caveat]_)
* Escaped whitespace characters are removed from the output document
together with the escaping backslash. This allows for `character-level
inline markup`_.
In `URI context` [#uri-context]_, backslash-escaped whitespace
represents a single space.
Backslashes have no special meaning in `literal context` [#literal-context]_.
Here, a single backslash represents a literal backslash, without having
to double up. [#caveat]_
.. [#caveat] Please note that the reStructuredText specification and
parser do not address the issue of the representation or extraction of
text input (how and in what form the text actually *reaches* the
parser). Backslashes and other characters may serve a
character-escaping purpose in certain contexts and must be dealt with
appropriately. For example, Python uses backslashes in string
literals to escape certain characters. The simplest solution when
backslashes appear in Python docstrings is to use raw docstrings::
r"""This is a raw docstring. Backslashes (\) are not touched."""
.. [#uri-context] In contexts where Docutils expects a URI (the link
block of `external hyperlink targets`_ or the argument of an `"image"`_
or `"figure"`_ directive), whitespace is ignored by default
.. [#literal-context]
In literal context (`literal blocks`_ and `inline literals`_,
content of the `"code"`_, `"math"`_, and `"raw"`_ directives,
content of the `"raw" role`_ and `custom roles`_ based on it),
reStructuredText markup characters lose their semantics
so there is no reason to escape them.
.. _reference name:
Reference Names
===============
`Reference names` identify elements for cross-referencing.
.. Note:: References to a target position in external, generated documents
must use the auto-generated `identifier key`_ which may differ from the
`reference name` due to restrictions on identifiers/labels in the
output format.
.. _simple reference name:
.. _simple reference names:
*Simple reference names* are single words consisting of alphanumerics
plus isolated (no two adjacent) internal hyphens, underscores,
periods, colons and plus signs; no whitespace or other characters are
allowed. Footnote labels (Footnotes_ & `Footnote References`_), citation
labels (Citations_ & `Citation References`_), `interpreted text`_ roles,
and some `hyperlink references`_ use the simple reference name syntax.
.. _phrase references:
Reference names using punctuation or whose names are phrases (two or
more space-separated words) are called *phrase references*.
Phrase-references are expressed by enclosing the phrase in backquotes
and treating the backquoted text as a reference name::
Want to learn about `my favorite programming language`_?
.. _my favorite programming language: https://www.python.org
Simple reference names may also optionally use backquotes.
.. _normalized reference names:
Reference names are whitespace-neutral and case-insensitive. [#case-forgiving]_
When resolving reference names internally:
- whitespace is normalized (one or more spaces, horizontal or vertical
tabs, newlines, carriage returns, or form feeds, are interpreted as
a single space), and
- case is normalized (all alphabetic characters are converted to
lowercase). [#case-forgiving]_
For example, the following `hyperlink references`_ are equivalent::
- `A HYPERLINK`_
- `a hyperlink`_
- `A
Hyperlink`_
Hyperlinks_, footnotes_, and citations_ all share the same namespace
for reference names. The labels of citations (simple reference names)
and manually-numbered footnotes (numbers) are entered into the same
database as other hyperlink names. This means that a footnote_
(defined as "``.. [#note]``") which can be referred to by a footnote
reference (``[#note]_``), can also be referred to by a plain hyperlink
reference (``note_``). Of course, each type of reference (hyperlink,
footnote, citation) may be processed and rendered differently. Some
care should be taken to avoid reference name conflicts.
`Substitution references`_ and `substitution definitions`_ use a
different namespace.
.. [#case-forgiving] Matching `substitution references`_ to
`substitution definitions`_ is `case-sensitive but forgiving`_.
Document Structure
==================
.. raw:: html
Document
--------
:Doctree element: `\`_
The top-level element of a parsed reStructuredText document is the
"document" element. After initial parsing, the document element is a
simple container for a document fragment, consisting of `body
elements`_, transitions_, and sections_, but lacking a document title
or other bibliographic elements. The code that calls the parser may
choose to run one or more optional post-parse transforms_,
rearranging the document fragment into a complete document with a
title and possibly other metadata elements (author, date, etc.; see
`Bibliographic Fields`_).
.. _document title:
Specifically, there is no way to indicate a document title and subtitle
explicitly in reStructuredText. [#]_ Instead, a lone top-level `section
title`_ can be treated as the *document title*. Similarly, a lone
second-level section title immediately after the document title can
become the *document subtitle*. The rest of the sections are then lifted
up a level or two. See the `DocTitle transform`_ for details.
.. [#] The `"title"`_ directive sets the document's `metadata title`_
that does not become part of the document body.
Sections
--------
:Doctree elements: `\`_, `\`_
.. _section title:
.. _section titles:
Sections are identified through their *titles*, which are marked up with
adornment: "underlines" below the title text, or underlines and
matching "overlines" above the title. An underline/overline is a
single repeated punctuation character that begins in column 1 and
forms a line extending at least as far as the right edge of the title
text. [#]_ Specifically, an underline/overline character may be any
non-alphanumeric printable 7-bit ASCII character [#]_. When an
overline is used, the length and character used must match the
underline. Underline-only adornment styles are distinct from
overline-and-underline styles that use the same character. There may
be any number of levels of section titles, although some output
formats may have limits (HTML has 6 levels).
.. [#] The key is the visual length of the title in a mono-spaced font.
The adornment may need more or less characters than title, if the
title contains wide__ or combining__ characters.
.. [#] The following are all valid section title adornment
characters::
! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
Some characters are more suitable than others. The following are
recommended::
= - ` : . ' " ~ ^ _ * + #
__ https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms#In_Unicode
__ https://en.wikipedia.org/wiki/Combining_character
Rather than imposing a fixed number and order of section title
adornment styles, the order enforced will be the order as encountered.
The first style encountered will be an outermost title (like HTML H1),
the second style will be a subtitle, the third will be a subsubtitle,
and so on.
Below are examples of section title styles::
===============
Section Title
===============
---------------
Section Title
---------------
Section Title
=============
Section Title
-------------
Section Title
`````````````
Section Title
'''''''''''''
Section Title
.............
Section Title
~~~~~~~~~~~~~
Section Title
*************
Section Title
+++++++++++++
Section Title
^^^^^^^^^^^^^
When a title has both an underline and an overline, the title text may
be inset, as in the first two examples above. This is merely
aesthetic and not significant. Underline-only title text may *not* be
inset.
A blank line after a title is optional. All text blocks up to the
next title of the same or higher level are included in a section (or
subsection, etc.).
All section title styles need not be used, nor need any specific
section title style be used. However, a document must be consistent
in its use of section titles: once a hierarchy of title styles is
established, sections must use that hierarchy.
Each section title automatically generates a hyperlink target pointing
to the section. The text of the hyperlink target (the "reference
name") is the same as that of the section title. See `Implicit
Hyperlink Targets`_ for a complete description.
Sections may contain `body elements`_, transitions_, and nested
sections.
Transitions
-----------
:Doctree element: `\`_
Instead of subheads, extra space or a type ornament between
paragraphs may be used to mark text divisions or to signal
changes in subject or emphasis.
(The Chicago Manual of Style, 14th edition, section 1.80)
Transitions are commonly seen in novels and short fiction, as a gap
spanning one or more lines, with or without a type ornament such as a
row of asterisks. Transitions separate other body elements. A
transition should not begin or end a section or document, nor should
two transitions be immediately adjacent.
The syntax for a transition marker is a horizontal line of 4 or more
repeated punctuation characters. The syntax is the same as section
title underlines without title text. Transition markers require blank
lines before and after::
Para.
----------
Para.
Unlike section title underlines, no hierarchy of transition markers is
enforced, nor do differences in transition markers accomplish
anything. It is recommended that a single consistent style be used.
The processing system is free to render transitions in output in any
way it likes. For example, horizontal rules (````) in HTML output
would be an obvious choice.
Body Elements
=============
Paragraphs
----------
:Doctree element: `\`_
Paragraphs consist of blocks of left-aligned text with no markup
indicating any other body element. Blank lines separate paragraphs
from each other and from other body elements. Paragraphs may contain
`inline markup`_.
Syntax diagram::
+------------------------------+
| paragraph |
| |
+------------------------------+
+------------------------------+
| paragraph |
| |
+------------------------------+
Bullet Lists
------------
:Doctree elements: `\`_, `\`_
A text block which begins with a "*", "+", "-", "•", "‣", or "⁃",
followed by whitespace, is a bullet list item (a.k.a. "unordered" list
item). List item bodies must be left-aligned and indented relative to
the bullet; the text immediately after the bullet determines the
indentation. For example::
- This is the first bullet list item. The blank line above the
first list item is required; blank lines between list items
(such as below this paragraph) are optional.
- This is the first paragraph in the second item in the list.
This is the second paragraph in the second item in the list.
The blank line above this paragraph is required. The left edge
of this paragraph lines up with the paragraph above, both
indented relative to the bullet.
- This is a sublist. The bullet lines up with the left edge of
the text blocks above. A sublist is a new list so requires a
blank line above and below.
- This is the third item of the main list.
This paragraph is not part of the list.
Here are examples of **incorrectly** formatted bullet lists::
- This first line is fine.
A blank line is required between list items and paragraphs.
(Warning)
- The following line appears to be a new sublist, but it is not:
- This is a paragraph continuation, not a sublist (since there's
no blank line). This line is also incorrectly indented.
- Warnings may be issued by the implementation.
Syntax diagram::
+------+-----------------------+
| "- " | list item |
+------| (body elements)+ |
+-----------------------+
Enumerated Lists
----------------
:Doctree elements: `\`_, `\`_
Enumerated lists (a.k.a. "ordered" lists) are similar to bullet lists,
but use enumerators instead of bullets. An enumerator consists of an
enumeration sequence member and formatting, followed by whitespace.
The following enumeration sequences are recognized:
- arabic numerals: 1, 2, 3, ... (no upper limit).
- uppercase alphabet characters: A, B, C, ..., Z.
- lower-case alphabet characters: a, b, c, ..., z.
- uppercase Roman numerals: I, II, III, IV, ..., MMMMCMXCIX (4999).
- lowercase Roman numerals: i, ii, iii, iv, ..., mmmmcmxcix (4999).
In addition, the auto-enumerator, "#", may be used to automatically
enumerate a list. Auto-enumerated lists may begin with explicit
enumeration, which sets the sequence. Fully auto-enumerated lists use
arabic numerals and begin with 1.
The following formatting types are recognized:
- suffixed with a period: "1.", "A.", "a.", "I.", "i.".
- surrounded by parentheses: "(1)", "(A)", "(a)", "(I)", "(i)".
- suffixed with a right-parenthesis: "1)", "A)", "a)", "I)", "i)".
While parsing an enumerated list, a new list will be started whenever:
- An enumerator is encountered which does not have the same format and
sequence type as the current list (e.g. "1.", "(a)" produces two
separate lists).
- The enumerators are not in sequence (e.g., "1.", "3." produces two
separate lists).
It is recommended that the enumerator of the first list item be
ordinal-1 ("1", "A", "a", "I", or "i"). Although other start-values
will be recognized, they may not be supported by the output format. A
level-1 [info] system message will be generated for any list beginning
with a non-ordinal-1 enumerator.
Lists using Roman numerals must begin with "I"/"i" or a
multi-character value, such as "II" or "XV". Any other
single-character Roman numeral ("V", "X", "L", "C", "D", "M") will be
interpreted as a letter of the alphabet, not as a Roman numeral.
Likewise, lists using letters of the alphabet may not begin with
"I"/"i", since these are recognized as Roman numeral 1.
The second line of each enumerated list item is checked for validity.
This is to prevent ordinary paragraphs from being mistakenly
interpreted as list items, when they happen to begin with text
identical to enumerators. For example, this text is parsed as an
ordinary paragraph::
A. Einstein was a really
smart dude.
However, ambiguity cannot be avoided if the paragraph consists of only
one line. This text is parsed as an enumerated list item::
A. Einstein was a really smart dude.
.. Caution::
If a single-line paragraph begins with text identical to an enumerator
("A.", "1.", "(b)", "I)", etc.), the first character will have to be
escaped in order to have the line parsed as an ordinary paragraph::
\A. Einstein was a really smart dude.
Alternatively, you can escape the delimiter ::
A\. Einstein was a really smart dude.
or use a literal NO-BREAK SPACE after the initial.
Examples of nested enumerated lists::
1. Item 1 initial text.
a) Item 1a.
b) Item 1b.
2. a) Item 2a.
b) Item 2b.
Example syntax diagram::
+-------+----------------------+
| "1. " | list item |
+-------| (body elements)+ |
+----------------------+
Definition Lists
----------------
:Doctree elements: `\`_, `\`_,
`\`_, `\`_, `\`_
Each definition list item contains a term, optional classifiers, and a
definition.
* A `term` is a simple one-line word or phrase. Escape_ a leading hyphen
to prevent recognition as an `option list`_ item.
* Optional `classifiers` may follow the term on the same line, each after
an inline " : " (space, colon, space). Inline markup is parsed in the
term line before the classifier delimiters are recognized. A delimiter
will only be recognized if it appears outside of any inline markup.
* A `definition` is a block indented relative to the term, and may
contain multiple paragraphs and other body elements. There may be no
blank line between a term line and a definition block (this
distinguishes definition lists from `block quotes`_). Blank lines are
required before the first and after the last definition list item, but
are optional in-between.
Example::
term 1
Definition 1.
term 2
Definition 2, paragraph 1.
Definition 2, paragraph 2.
term 3 : classifier
Definition 3.
term 4 : classifier one : classifier two
Definition 4.
\-term 5
Without escaping, this would be an option list item.
A definition list may be used in various ways, including:
- As a dictionary or glossary. The term is the word itself, a
classifier may be used to indicate the usage of the term (noun,
verb, etc.), and the definition follows.
- To describe program variables. The term is the variable name, a
classifier may be used to indicate the type of the variable (string,
integer, etc.), and the definition describes the variable's use in
the program. This usage of definition lists supports the classifier
syntax of Grouch_, a system for describing and enforcing a Python
object schema.
Syntax diagram::
+----------------------------+
| term [ " : " classifier ]* |
+--+-------------------------+--+
| definition |
| (body elements)+ |
+----------------------------+
Field Lists
-----------
:Doctree elements: `\`_, `\`_,
`\`_, `\`_
Field lists are used as part of an extension syntax, such as options
for directives_, or database-like records meant for further
processing. They may also be used for two-column table-like
structures resembling database records (label & data pairs).
Applications of reStructuredText may recognize field names and
transform fields or field bodies in certain contexts. For examples,
see `Bibliographic Fields`_ or `directive options`_ below or the
`"meta"`_ directive.
.. _field names:
Field lists are mappings from *field names* to *field bodies*, modeled on
RFC822_ headers. A field name may consist of any characters, but
colons (":") inside of field names must be backslash-escaped
when followed by whitespace.\ [#]_
Inline markup is parsed in field names, but care must be taken when
using `interpreted text`_ with explicit roles in field names: the role
must be a suffix to the interpreted text. Field names are
case-insensitive when further processed or transformed. The field
name, along with a single colon prefix and suffix, together form the
field marker. The field marker is followed by whitespace and the
field body. The field body may contain multiple body elements,
indented relative to the field marker. The first line after the field
name marker determines the indentation of the field body. For
example::
:Date: 2001-08-16
:Version: 1
:Authors: - Me
- Myself
- I
:Indentation: Since the field marker may be quite long, the second
and subsequent lines of the field body do not have to line up
with the first line, but they must be indented relative to the
field name marker, and they must line up with each other.
:Parameter i: integer
The interpretation of individual words in a multi-word field name is
up to the application. The application may specify a syntax for the
field name. For example, second and subsequent words may be treated
as "arguments", quoted phrases may be treated as a single argument,
and direct support for the "name=value" syntax may be added.
Standard RFC822_ headers cannot be used for this construct because
they are ambiguous. A word followed by a colon at the beginning of a
line is common in written text. However, in well-defined contexts
such as when a field list invariably occurs at the beginning of a
document (PEPs and email messages), standard RFC822 headers could be
used.
Syntax diagram (simplified)::
+--------------------+----------------------+
| ":" field name ":" | field body |
+-------+------------+ |
| (body elements)+ |
+-----------------------------------+
.. [#] Up to Docutils 0.14, field markers were not recognized when
containing a colon.
Bibliographic Fields
````````````````````
:Doctree elements: `\`_, `\`_, `\`_,
`\`_, `\`_, `\`_,
`\`_, `\`_, `\`_,
`\`_, `\`_, `\`_
When a field list is the document body's first element [#PreBibliographic]_,
it may have its fields transformed__ to bibliographic data.
This bibliographic data corresponds to the front matter of a book,
such as the title page and copyright page.
.. [#PreBibliographic]
A `document title`_, header and footer as well as elements that
do not show up in the output before the bibliographic fields don't
count. See `PreBibliographic Elements`_ for details.
__ `DocInfo transform`_
Certain registered field names (listed below) are recognized and
transformed to the corresponding doctree elements, most becoming child
elements of the `\`_ element. No ordering is required of these
fields, although they may be rearranged to fit the document structure,
as noted. Unless otherwise indicated below, each of the bibliographic
elements' field bodies may contain a single paragraph only. Field
bodies may be checked for `RCS keywords`_ and cleaned up. Any
unrecognized fields will remain as generic fields in the docinfo
element.
.. _bibliographic field names:
The registered bibliographic field names and their corresponding
doctree elements are as follows:
============= ================
Field name doctree element
============= ================
Abstract `\`_
Address `\`_
Author `\`_
Authors `\`_
Contact `\`_
Copyright `\`_
Date `\`_
Dedication `\`_
Organization `\`_
Revision `\`_
Status `\`_
Version `\`_
============= ================
The "Authors" field may contain either: a single paragraph consisting
of a list of authors, separated by ";" or "," (";" is checked first,
so "Doe, Jane; Doe, John" will work.); multiple paragraphs (one per
author); or a bullet list whose elements each contain a single
paragraph per author. In some languages
(e.g. Swedish), there is no singular/plural distinction between
"Author" and "Authors", so only an "Authors" field is provided, and a
single name is interpreted as an "Author". If a single name contains
a comma, end it with a semicolon to disambiguate: ":Authors: Doe,
Jane;".
The "Address" field is for a multi-line surface mailing address.
Newlines and whitespace will be preserved.
The "Dedication" and "Abstract" fields may contain arbitrary body
elements. Only one of each is allowed. They become topic elements
with "Dedication" or "Abstract" titles (or language equivalents)
immediately following the docinfo element.
This field-name-to-element mapping can be replaced for other
languages. See `Docutils Internationalization`_ for details.
Unregistered/generic fields may contain one or more paragraphs or
arbitrary body elements. To support custom styling, the field name is
also added to the `"classes" attribute`_ value after being converted
into a valid identifier form.
RCS Keywords
````````````
`Bibliographic fields`_ recognized by the parser are normally checked
for RCS [#]_ keywords and cleaned up [#]_. RCS keywords may be
entered into source files as "$keyword$", and once stored under RCS,
CVS [#]_, or SVN [#]_, they are expanded to "$keyword: expansion text $".
For example, a "Status" field will be transformed to a "status" element::
:Status: $keyword: expansion text $
.. [#] Revision Control System.
.. [#] RCS keyword processing can be turned off (unimplemented).
.. [#] Concurrent Versions System. CVS uses the same keywords as RCS.
.. [#] Subversion Versions System. Uses the same keywords as RCS.
Processed, the "status" element's text will become simply "expansion
text". The dollar sign delimiters and leading RCS keyword name are
removed.
The RCS keyword processing only kicks in when the field list is in
bibliographic context (first non-comment construct in the document,
after a document title if there is one).
.. _option list:
Option Lists
------------
:Doctree elements: `\`_, `\`_,
`\`_, `\