开发者

How to make an internal hyperlink in Sphinx documentation [duplicate]

开发者 https://www.devze.com 2023-01-30 00:40 出处:网络
This question already has answers here: Adding a cross-reference to a subheading or anchor in another page
This question already has answers here: Adding a cross-reference to a subheading or anchor in another page (6 answers) 开发者_C百科 Closed 1 year ago.

How to make an internal hyperlink in Sphinx documentation? I am using:

:role:`target`

But it is not working.


Cross-referencing is done using a ref

:ref:`label-name`

You can provide your labels using:

.. _label-name:

See: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref

Roles are used to create custom interpreted text. See: http://docutils.sourceforge.net/docs/ref/rst/directives.html#role


In somewhere the heading is,

.. _HeaderTag:

Header
------

Ref to above header (may not the same file)

:ref:`HeaderTag`

# or with custom text
:ref:`custom header<HeaderTag>`
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号