reStructuredText 链接到包含自定义文本的部分

问题描述 投票:0回答:2

我知道 reStructuredText 手册中有关“隐式超链接”的文档,但我想知道是否可以引用某个部分而不必重复完整的部分标题。例如。如果我从文档中获取示例, Titles are targets, too ======================= Implict references, like `Titles are targets, too`_.

然后我想有一种方法通过使用不同的链接名称(例如
`the target section`_

)来引用该部分。我怎样才能做到这一点?

    

restructuredtext
2个回答
11
投票
Titles are targets, too

的部分:


`link text <Titles are targets, too_>`_

这将创建一个链接,其文本为 
link text

,但指向标题为

Titles are targets, too
的部分。
    


0
投票

.. _Hyperlinks: How to define Hyperlinks with reStructuredText ============================================== This is the section about Hyperlinks_.

如果文档中多次需要短参考名称,则特别有用。但要小心污染“超链接命名空间”。

© www.soinside.com 2019 - 2024. All rights reserved.