如何在 Sphinx 文档中创建内部超链接?我在用:
:role:`target`
但它不起作用。
交叉引用是使用ref
:ref:`label-name`
您可以使用以下方式提供标签:
.. _label-name:
请参阅:https ://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref
角色用于创建自定义解释文本。请参阅:http ://docutils.sourceforge.net/docs/ref/rst/directives.html#role
在某处,标题是,
.. _HeaderTag:
Header
------
参考上面的标题(可能不是同一个文件)
:ref:`HeaderTag`
# or with custom text
:ref:`custom header<HeaderTag>`