创建一个带有独立文本的 link
Create a link with independent text
是否可以使用 sphinx 创建文档内 link,以便显示的文本独立于 link 和目标?
目前,我像这样制作文档内 links:
.. _Label_For_Section:
===============
Name Of Section
===============
The link :ref:`Label_For_Section` is rendered as "Name Of Section".
The link Label_For_Section_ is rendered as "Label_For_Section".
我想要的是一种获得 link 的方法,其中目标文本、link 标签和显示的 link 文本都可以是不同的字符串。例如 link 到名为 "A" 的部分,标签为 .. _B:
,呈现为 "C"
备注
我注意到其他类型的 links(例如外部 hyperlinks)也有类似的限制,我认为解决方案可能看起来相似,但我正在寻找专门用于文档内 links.
见Cross-referencing arbitrary locations, specifically the ref
role。
:ref:`Link title <label-name>`
是否可以使用 sphinx 创建文档内 link,以便显示的文本独立于 link 和目标? 目前,我像这样制作文档内 links:
.. _Label_For_Section:
===============
Name Of Section
===============
The link :ref:`Label_For_Section` is rendered as "Name Of Section".
The link Label_For_Section_ is rendered as "Label_For_Section".
我想要的是一种获得 link 的方法,其中目标文本、link 标签和显示的 link 文本都可以是不同的字符串。例如 link 到名为 "A" 的部分,标签为 .. _B:
,呈现为 "C"
备注
我注意到其他类型的 links(例如外部 hyperlinks)也有类似的限制,我认为解决方案可能看起来相似,但我正在寻找专门用于文档内 links.
见Cross-referencing arbitrary locations, specifically the ref
role。
:ref:`Link title <label-name>`