reStructuredText 域

版本 1.0 新增。

reStructuredText 域(名称为 rst)提供以下指令

.. rst:directive:: 名称

描述 reStructuredText 指令。名称 可以是单个指令名称或实际指令语法(.. 前缀和 :: 后缀)以及将以不同方式渲染的参数。例如

.. rst:directive:: foo

   Foo description.

.. rst:directive:: .. bar:: baz

   Bar description.

将渲染为

.. foo::

Foo 描述。

.. bar:: baz

Bar 描述。

.. rst:directive:option:: 名称

描述 reStructuredText 指令的选项。名称 可以是单个选项名称或带参数的选项名称,参数之间用冒号 (:) 分隔。例如

.. rst:directive:: toctree

   .. rst:directive:option:: caption: caption of ToC

   .. rst:directive:option:: glob

将渲染为

.. toctree::
:caption: ToC 标题
:glob

选项

:type: 参数描述 (文本)

描述选项值的类型。

例如

.. rst:directive:: toctree

   .. rst:directive:option:: maxdepth
      :type: integer or no value

2.1 版本新增。

.. rst:role:: 名称

描述 reStructuredText 角色。例如

.. rst:role:: foo

   Foo description.

将渲染为

:foo:

Foo 描述。

提供这些角色是为了引用所描述的对象

:rst:dir:

引用指令和指令选项。示例

  • 使用 :rst:dir:`my-directive` 引用指令。

  • 使用 :rst:dir:`my-directive:my-option` 引用指令选项。

:rst:role:

引用角色。示例::rst:role:`my-role`