How to make an internal hyperlink in Sphinx documentation

Question:

How to make an internal hyperlink in Sphinx documentation?
I am using:

:role:`target`

But it is not working.

Asked By: ajax-ie

||

Answers:

Cross-referencing is done using a ref

:ref:`label-name`

You can provide your labels using:

.. _label-name:

See: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref

Roles are used to create custom interpreted text. See: http://docutils.sourceforge.net/docs/ref/rst/directives.html#role

Answered By: pyfunc

In somewhere the heading is,

.. _HeaderTag:

Header
------

Ref to above header (may not the same file)

:ref:`HeaderTag`

# or with custom text
:ref:`custom header<HeaderTag>`
Answered By: Anh-Thi DINH
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.