Thank you @bad_coder and @Steve Piercy! So this question's answer is what I was looking for, but was not formulated in a way I could find it. For anyone who would end up here, what worked for me is :

Define a target in page-A, by adding before the section title:

.. _target name in page A:

Refer to this target in page-B, simply with:

:ref:`target name in page A`

Note that you do not need to add page-A name, the reference will be automatically found.

It also works to use a relative html link, but this is far less robust (it would break if section names are changing, for instance):

`Link name <page_A.html#subsection>`_
Answer from jeannej on Stack Overflow
🌐
Sphinx
sphinx-doc.org › en › master › usage › referencing.html
Cross-references — Sphinx documentation
A cross reference to an object description, such as :func:`spam`, will create a link to the place where spam() is documented, appropriate to each output format (HTML, PDF, ePUB, etc.). Sphinx supports various cross-referencing roles to create links to other elements in the documentation.
🌐
Nipy
nipy.org › nipy › devel › guidelines › sphinx_helpers.html
Sphinx Cheat Sheet - NIPY documentation
Wherein I show by example how to do some things in Sphinx (you can see a literal version of this file below in This file) ... This shows you how to make a table – if you only want to make a list see Making a list. Use reST labels to cross-reference sections and other documents.
🌐
Readthedocs
ikerdocs-sphinx.readthedocs.io › syntax › refs.html
Cross references - Sphinx documentation - Read the Docs
Then you can reference to those labels in the reST way (only works for labels within the document): ... Which can be used between documents. ... Section titles, footnotes, and citations automatically are link targets. ... According to the Sphinx documentation you can also user the :ref: role directly with the label name (e.g.
🌐
Readthedocs
ikerdocs-sphinx.readthedocs.io › extras › crossref.html
Cross referencing Python objects — Sphinx documentation
The py that precedes each identifier refers to the domain. In this case it implies the Python domain. The Python domain is the default one, but it can be modified using the default-domain directive or the config value primary_domain. When cross referencing an object of the default domain, it ...
🌐
Qiskit
qiskit.github.io › qiskit_sphinx_theme › sphinx_guide › how_to_cross-reference.html
How to cross-reference to other pages from documentation - Qiskit Docs Guide
You can also use practically the same syntax to link to pages from other documentation projects. For this to work you need to add sphinx.ext.intersphinx to the extensions variable of your docs/conf.py.
🌐
Sphinx
sphinx-doc.org › en › master › usage › extensions › intersphinx.html
sphinx.ext.intersphinx – Link to other projects’ documentation — Sphinx documentation
This extension can generate links to the documentation of objects in external projects, either explicitly through the external role, or as a fallback resolution for any other cross-reference. Usage for fallback resolution is simple: whenever Sphinx encounters a cross-reference that has no matching ...
Top answer
1 of 7
257

The expression "reST/Sphinx" makes the scope of the question unclear. Is it about reStructuredText in general and Sphinx, or only about reStructuredText as used in Sphinx (and not reStructuredText in general)? I'm going to cover both since people using RST are likely to run into both cases at some point:

Sphinx

Besides the domain-specific directives that can be used to link to various entities like classes (:class:) there's the general :ref: directive, documented here. They give this example:

    .. _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`.

Although the general hyperlinking mechanism offered by RST does work in Sphinx, the documentation recommends against using it when using Sphinx:

Using ref is advised over standard reStructuredText links to sections (like Section title_) because it works across files, when section headings are changed, and for all builders that support cross-references.

RST, in General

The tools that convert RST files to HTML do not necessarily have a notion of collection. This is the case for instance if you rely on github to convert RST files to HTML or if you use a command line tool like rst2html. Unfortunately, the various methods to use to get the desired result vary depending on which tool you are using. For instance, if you use rst2html and you want file A.rst to link to a section named "Section" in file other.rst and you want the final HTML to work in a browser, then A.rst would contain:

`This <other.html#section>`__ is a reference to a section in another
file, which works with ``rst2html``. Unfortunately, it does not work
when the HTML is generated through github.

You have to link to the final HTML file and you have to know what the id given to the section will be. If you want to do the same for a file served through github:

`This <other.rst#section>`__ is a reference to a section in another
file, which works on github. Unfortunately, it does not work when you
use ``rst2html``.

Here too you need to know the id given to the section. However, you link to the RST file because it is only upon accessing the RST file that the HTML is created. (At the time of writing this answer, accessing the HTML directly is not allowed.)

A complete example is available here.

2 of 7
75

New, better answer for 2016!

The autosection extension lets you do this easily.

=============
Some Document
=============


Internal Headline
=================

then, later...

===============
Some Other Doc
===============


A link-  :ref:`Internal Headline`

This extension is built-in, so all you need is to edit conf.py

extensions = [
    .
    . other
    . extensions
    . already
    . listed
    .
    'sphinx.ext.autosectionlabel',
]

The only thing you have to be careful of is that now you can't duplicate internal headlines across the doc collection. (Worth it.)

Find elsewhere
🌐
Sphinx
sphinx-doc.org › en › master › usage › restructuredtext › roles.html
Roles — Sphinx documentation
A reference to a Python Enhancement Proposal. This generates appropriate index entries. The text “PEP number“ is generated; in the HTML output, this text is a hyperlink to an online copy of the specified PEP.
🌐
Readthedocs
docs.readthedocs.io › en › stable › guides › intersphinx.html
How to link to other documentation projects with Intersphinx — Read the Docs user documentation
Intersphinx allows you to use all cross-reference roles from Sphinx with objects in other projects. That is, you could use the :ref: role to link to sections of other documentation projects.
🌐
CKAN
docs.ckan.org › en › latest › contributing › documentation.html
Writing documentation — CKAN 2.13.0a0 documentation
Whenever you mention a Python function, method, object, class, exception, etc. cross-reference it using a Sphinx domain object cross-reference.
🌐
ROS
docs.ros.org › en › eloquent › Contributing › Inter-Sphinx-Support.html
Using Sphinx for cross-referencing packages — ROS 2 Documentation: Eloquent documentation
If you prefix the content with ~, the link text will only be the last component of the target. For example, :py:meth:\`~Queue.Queue.get\` will refer to Queue.Queue.get but only display get as the link text.
🌐
GitHub
github.com › sphinx-doc › sphinx › issues › 11734
Sphinx toctree cannot contain cross reference explicit target · Issue #11734 · sphinx-doc/sphinx
October 23, 2023 - Using this guide and sphinx-quickstart grab a fresh project, then replace the index.rst with this: Testing ======= .. Define an explicit target. .. _my-target: .. These all error out. .. toctree:: :ref:`My Target <my-target>` `My Target <my-target>`_ My Target <my-target> `my-target`_ my-target .. These both work. :ref:`My Target <my-target>` `my-target`_ ... /private/tmp/docs/source/index.rst:6: WARNING: toctree contains reference to nonexisting document ':ref:`My Target <my-target>`' /private/tmp/docs/source/index.rst:6: WARNING: toctree contains reference to nonexisting document '`My Target
Author: sphinx-doc
🌐
Gitlab
flyart.gitlab.io › sphinx-doc › _chapters › crossRefs.html
Cross References — sphinx-doc 0.1 documentation
Just in the same way as you would cross-reference objects in Latex, it is possible in Sphinx to assign labels to objects (i.e., titles of sections, figures, etc.); labels can then be used to make references.
🌐
7-Zip Documentation
documentation.help › Sphinx › domains.html
Sphinx Domains - Sphinx Documentation
The directive will create a cross-reference target named after the first option, referencable by option (in the example case, you’d use something like :option:`-m`). ... Describes an environment variable that the documented code or program uses or defines. Referencable by envvar.