Skip to content

Commit 2e6570a

Browse files
authored
Merge pull request #26412 from meeseeksmachine/auto-backport-of-pr-26405-on-v3.7.x
Backport PR #26405 on branch v3.7.x (DOC: Clarify the difference between document and section references)
2 parents f59b3b6 + 707fde1 commit 2e6570a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

doc/devel/documenting_mpl.rst

+18-3
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,24 @@ nor the ````literal```` role:
187187
Referring to other documents and sections
188188
-----------------------------------------
189189

190-
Sphinx_ allows internal references_ between documents.
190+
Sphinx_ supports internal references_:
191191

192-
Documents can be linked with the ``:doc:`` directive:
192+
========== =============== ===========================================
193+
Role Links target Representation in rendered HTML
194+
========== =============== ===========================================
195+
|doc-dir|_ document link to a page
196+
|ref-dir|_ reference label link to an anchor associated with a heading
197+
========== =============== ===========================================
198+
199+
.. The following is a hack to have a link with literal formatting
200+
See https://stackoverflow.com/a/4836544
201+
202+
.. |doc-dir| replace:: ``:doc:``
203+
.. _doc-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-doc
204+
.. |ref-dir| replace:: ``:ref:``
205+
.. _ref-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref
206+
207+
Examples:
193208

194209
.. code-block:: rst
195210
@@ -207,7 +222,7 @@ will render as:
207222

208223
See the example :doc:`/gallery/lines_bars_and_markers/simple_plot`
209224

210-
Sections can also be given reference names. For instance from the
225+
Sections can also be given reference labels. For instance from the
211226
:doc:`/users/installing/index` link:
212227

213228
.. code-block:: rst

0 commit comments

Comments
 (0)