Adding a cross-reference to a subheading or anchor in another page

后端 未结 4 2043
-上瘾入骨i
-上瘾入骨i 2020-12-04 10:37

How to insert a cross-reference in a reST/Sphinx page to either a sub-header or anchor in another page in the same documentation set?

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 11:14

    Example:

    Hey, read the :ref:`Installation:Homebrew` section.
    

    where Homebrew is a section inside a different document named Installation.rst.

    This uses the autosection feature, so will need to edit config.py with the following:

    extensions = [
        'sphinx.ext.autosectionlabel'
    ]
    autosectionlabel_prefix_document = True
    

提交回复
热议问题