======================= 角色 ======================= sphinx使用解释文本角色将语义标记插入到文档中。它们被写为 ``:rolename:`content '``. 交叉引用任意位置 / 锚 ======================= 添加锚的步骤: #. 添加 label #. 适用 ref 角色 链接 label 为了支持对任何文档中任意位置的交叉引用,使用标准的REST标签。为此,在整个文档中,工作标签名称必须是唯一的。有两种方法可以引用标签: * ``:ref:`Label``` * 如果将标签直接放置在节标题之前,可以使用 ``:ref:`label-name``` .例如: .. code-block:: rest .. _my-reference-label: Section to cross-reference -------------------------- This is the text of the section. It refers to the section itself, see :ref:`my-reference-label`. .. 当节和引用位于不同的源文件中时,这也同样有效。 * 自动标签同样适用于图像 .. code-block:: rest .. _my-figure: .. figure:: whatever Figure caption * ``:ref:`description _