Sphinx 中的嵌套 URL

发布于 2025-01-13 13:11:04 字数 411 浏览 2 评论 0原文

假设我在 file.rst 中有两个链接:

.. _link1: https://link1.com
.. _link2: https://link1.com/val

有没有办法在 link2 中使用 link1 ,就像我下面使用自定义显示文本一样对于用户:

.. _link1: https://link1.com
.. _link2: link1/val

这就是我打算使用它的方式:

See link `here <link1_>`_ for more details check `this <link2_>`_ out.

Say I have two links in a file.rst :

.. _link1: https://link1.com
.. _link2: https://link1.com/val

Is there a way to use link1 in link2 like what I have below with custom display text for the user:

.. _link1: https://link1.com
.. _link2: link1/val

This is how I intend to use it:

See link `here <link1_>`_ for more details check `this <link2_>`_ out.

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

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

发布评论

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

评论(1

我早已燃尽 2025-01-20 13:11:04

您可以使用 Sphinx 扩展 extlinks

此扩展旨在帮助解决一种常见模式,即拥有许多指向同一个站点上的 URL 的外部链接,例如指向错误跟踪器、版本控制 Web 界面或其他网站中的子页面的链接。它通过为基本 URL 提供别名来实现这一点,这样您在创建链接时只需提供子页面名称。

You could use the Sphinx extension extlinks.

This extension is meant to help with the common pattern of having many external links that point to URLs on one and the same site, e.g. links to bug trackers, version control web interfaces, or simply subpages in other websites. It does so by providing aliases to base URLs, so that you only need to give the subpage name when creating a link.

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