Sphinx 交叉引用尖括号中的内容?

Sphinx cross reference what goes in angle brackets?

我看到很多这样的例子

:ref:`code <target to code>`

在 Sphinx 文档中,但我找不到它在哪里定义了 code <target to code> 的含义。也许其中一个是隐式或显式目标,另一个是文件路径??

如果有人能给我举例说明如何交叉引用特定 .rst 文件中的标题?

来自 Adding a cross-reference to a subheading or anchor in another page 我知道如何使用 :any 角色,但不知道如何对特定文件执行 :ref:

来自 Cross-referencing syntax 的文档:

Cross-references are generated by many semantic interpreted text roles. Basically, you only need to write

:role:`target`

and a link will be created to the item named target of the type indicated by role. The link’s text will be the same as target.

There are some additional facilities, however, that make cross-referencing roles more versatile:

  • You may supply an explicit title and reference target, like in reST direct hyperlinks:

    :role:`title <target>`
    

    will refer to target, but the link text will be title.

请注意,有时 title 也称为 label,具体取决于上下文。