如何在 Sphinx 文档中创建内部超链接

发布于 2024-10-06 17:55:35 字数 128 浏览 0 评论 0原文

如何在Sphinx文档中创建内部超链接? 我正在使用:

:role:`target`

但它不起作用。

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

:role:`target`

But it is not working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾其所爱 2024-10-13 17:55:35

交叉引用是使用 ref 完成的。

:ref:`label-name`

您可以使用以下方式提供标签:

.. _label-name:

请参阅:https://www.sphinx-doc.org/en/master/usage/restructedtext/roles.html#role-ref

角色用于创建自定义解释文本。请参阅:http://docutils.sourceforge.net/docs/ref/rst /directives.html#role

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

朱染 2024-10-13 17:55:35

在某处标题是,

.. _HeaderTag:

Header
------

参考上面的标题(可能不是同一个文件)

:ref:`HeaderTag`

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

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>`
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文