Skip to content

Commit 58a35aa

Browse files
committed
DOC: Clarify the difference between document and section references
1 parent 0dc8c2f commit 58a35aa

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

doc/devel/document.rst

+19-3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,25 @@ nor the ````literal```` role:
194194
Refer to other documents and sections
195195
-------------------------------------
196196

197-
Sphinx_ allows internal references_ between documents.
197+
Sphinx_ supports internal references_:
198198

199-
Documents can be linked with the ``:doc:`` directive:
199+
========== =========================== ===========================================
200+
Role Links target Representation in rendered HTML
201+
========== =========================== ===========================================
202+
|doc-dir|_ document link to a page
203+
|ref-dir|_ reference label (associated link to an anchor associated with a heading
204+
with a section)
205+
========== =========================== ===========================================
206+
207+
.. The following is a hack to have a link with literal formatting
208+
See https://stackoverflow.com/a/4836544 and https://sphinx-doc.org/faq.html#reference-to-arbitrary-locations-in-external-documents
209+
210+
.. |doc-dir| replace:: ``:doc:``
211+
.. _doc-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-doc
212+
.. |ref-dir| replace:: ``:ref:``
213+
.. _ref-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref
214+
215+
Examples:
200216

201217
.. code-block:: rst
202218
@@ -214,7 +230,7 @@ will render as:
214230

215231
See the example :doc:`/gallery/lines_bars_and_markers/simple_plot`
216232

217-
Sections can also be given reference names. For instance from the
233+
Sections can also be given reference labels. For instance from the
218234
:doc:`/users/installing/index` link:
219235

220236
.. code-block:: rst

0 commit comments

Comments
 (0)