| 1 |
.. highlight:: rst |
| 2 |
|
| 3 |
=========== |
| 4 |
Field Lists |
| 5 |
=========== |
| 6 |
|
| 7 |
:ref:`As previously discussed <rst-field-lists>`, field lists are sequences of |
| 8 |
fields marked up like this:: |
| 9 |
|
| 10 |
:fieldname: Field content |
| 11 |
|
| 12 |
Sphinx extends standard docutils behavior for field lists and adds some extra |
| 13 |
functionality that is covered in this section. |
| 14 |
|
| 15 |
.. note:: |
| 16 |
|
| 17 |
The values of field lists will be parsed as |
| 18 |
strings. You cannot use Python collections such as lists or dictionaries. |
| 19 |
|
| 20 |
|
| 21 |
.. _metadata: |
| 22 |
|
| 23 |
File-wide metadata |
| 24 |
------------------ |
| 25 |
|
| 26 |
A field list near the top of a file is normally parsed by docutils as the |
| 27 |
*docinfo* and shown on the page. However, in Sphinx, a field list preceding |
| 28 |
any other markup is moved from the *docinfo* to the Sphinx environment as |
| 29 |
document metadata, and is not displayed in the output. |
| 30 |
|
| 31 |
.. note:: |
| 32 |
|
| 33 |
A field list appearing after the document title *will* be part of the |
| 34 |
*docinfo* as normal and will be displayed in the output. |
| 35 |
|
| 36 |
|
| 37 |
Special metadata fields |
| 38 |
----------------------- |
| 39 |
|
| 40 |
Sphinx provides custom behavior for bibliographic fields compared to docutils. |
| 41 |
|
| 42 |
At the moment, these metadata fields are recognized: |
| 43 |
|
| 44 |
``tocdepth`` |
| 45 |
The maximum depth for a table of contents of this file. :: |
| 46 |
|
| 47 |
:tocdepth: 2 |
| 48 |
|
| 49 |
.. note:: |
| 50 |
|
| 51 |
This metadata affects the depth of the local toctree. But it does not |
| 52 |
affect the depth of the *global* toctree. So this does not change |
| 53 |
the sidebar of themes that use the global toctree. |
| 54 |
|
| 55 |
.. versionadded:: 0.4 |
| 56 |
|
| 57 |
``nocomments`` |
| 58 |
If set, the web application won't display a comment form for a page |
| 59 |
generated from this source file. :: |
| 60 |
|
| 61 |
:nocomments: |
| 62 |
|
| 63 |
``orphan`` |
| 64 |
If set, warnings about this file not being included in any toctree will be |
| 65 |
suppressed. :: |
| 66 |
|
| 67 |
:orphan: |
| 68 |
|
| 69 |
.. versionadded:: 1.0 |
| 70 |
|
| 71 |
``no-search`` |
| 72 |
Disable full text search for this document. |
| 73 |
|
| 74 |
.. code-block:: rst |
| 75 |
|
| 76 |
:no-search: |
| 77 |
|
| 78 |
.. note:: |
| 79 |
The ``:no-search:`` option only disables full text search, |
| 80 |
meaning that object search will still be available even if |
| 81 |
``:no-search:`` is set. |
| 82 |
|
| 83 |
.. versionadded:: 3.0 |
| 84 |
|
| 85 |
.. versionchanged:: 7.3 |
| 86 |
|
| 87 |
The file-wide metadata option ``:nosearch:`` was renamed |
| 88 |
to ``:no-search:``. |
| 89 |
The previous name has been retained as an alias, |
| 90 |
but will be deprecated and removed |
| 91 |
in a future version of Sphinx. |