启用autosectionlabel和autosectionlabel_prefix_document后,如何使用sphinx引用本地文档中的小节标题。我的文档有详细的嵌套文件夹安排,并希望用代表本地文件的内容替换长路径。 #,或本地文件名不起作用
示例
Heading 1
---------
subheading
^^^^^^^^^^
:ref:`/full/path/relative_to_config_file:subheading` works
答案 0 :(得分:0)
我对autosectionlabel
的文档一无所知。我认为您可以在没有绝对参考的情况下做您想做的事情:
Heading 1
---------
subheading
^^^^^^^^^^
:ref:`relative/to/config/file:subheading`
或者也许:
:ref:`relative-to-config-file:subheading`
否则,您将必须使用任意cross-references。
如果将标签直接放在节标题之前,则可以使用:ref:
label-name
对其进行引用。例如:
.. _my-reference-label:
Section to cross-reference
--------------------------
This is the text of the section.
It refers to the section itself, see :ref:`my-reference-label`.
答案 1 :(得分:0)
似乎唯一的方法是使用html样式链接 例如
`Text to display instead of subheading <#subheading>`_