开发者

Sphinx: cross-reference indexed item

How can I cross-reference an i开发者_JS百科ndexed item inside a reStructuredText document?

For example, how can I cross-reference SectionB:

.. index::
    pair: SectionA; SectionB

SectionB
--------

SectionB description.

I tried using the index labels in references, such as:

:ref:`SectionB`

but this does not work.


see: Cross-referencing arbitrary locations

in the Sphinx documentation.

I think what you might be missing is a reference label,

Try something like:

.. index::
pair: SectionA; SectionB

.. _section-b-label:

SectionB
--------

SectionB description.

and then elsewhere do:

:ref:`section-b-label`


This options still does not seem possible without adding in custom labels. There is an issue open at https://github.com/sphinx-doc/sphinx/issues/1671

It is possible to link to glossary terms using :term:, and index links ideally would be possible and added to the arbitrary links docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜