Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an internal hyperlink in Sphinx documentation [duplicate]

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

:role:`target` 

But it is not working.

like image 786
ajax-ie Avatar asked Dec 08 '10 08:12

ajax-ie


People also ask

What is Toctree?

The toctree directive is the central element. Note. Simple “inclusion” of one file in another can be done with the include directive. Note. To create table of contents for current document (.

Does Sphinx support markdown?

To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.


2 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

like image 125
pyfunc Avatar answered Sep 20 '22 13:09

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>` 
like image 24
Anh-Thi DINH Avatar answered Sep 18 '22 13:09

Anh-Thi DINH