reStructuredText 域¶
在版本 1.0 中添加。
reStructuredText 域(名称 rst)提供以下指令
- .. rst:directive:: name¶
描述 reStructuredText 指令。name 可以是单个指令名称或实际的指令语法(.. 前缀和 :: 后缀),带有将以不同方式呈现的参数。例如
.. rst:directive:: foo Foo description. .. rst:directive:: .. bar:: baz Bar description.
将被渲染为
- .. foo::¶
Foo 描述。
- .. bar:: baz¶
Bar 描述。
- .. rst:directive:option:: name¶
描述 reStructuredText 指令的选项。name 可以是单个选项名称或带有参数的选项名称,参数用冒号 (
:
) 分隔。例如.. 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:: name¶
描述 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`
。