字段列表

如前所示,字段列表是像这样标记的字段序列:

:fieldname: Field content

Sphinx扩展了字段列表的标准docutils行为,并添加了一些本节将介绍的额外功能。

备注

字段列表的值将被解析为字符串。不能使用Python集合,如列表或字典。

文件范围元数据

文件顶部附近的字段列表通常被docutils解析为*docinfo*并显示在页面上。但是,在Sphinx中,任何其他标记之前的字段列表将作为文档元数据从*docinfo*移到Sphinx环境中,并且不在输出中显示。

备注

一个字段列表出现在文档标题之后,将会像往常一样成为*docinfo*的一部分,并显示在输出中。

特殊的元数据字段

与docutils相比,Sphinx为书目字段提供了自定义行为。

目前,可以识别这些元数据字段:

tocdepth

此文件目录的最大深度。:

:tocdepth: 2

备注

This metadata affects the depth of the local toctree. But it does not affect the depth of the global toctree. So this does not change the sidebar of themes that use the global toctree.

Added in version 0.4.

nocomments

如果已设置,则web应用程序将不显示从此源文件生成的页面的注释表单。:

:nocomments:
orphan

如果设置,则有关此文件未包含在任何目录树中的警告将被抑制。:

:orphan:

Added in version 1.0.

nosearch

如果设置,则禁用此文件的全文搜索。:

:nosearch:

备注

object search is still available even if nosearch option is set.

Added in version 3.0.