Skip to content

Commit 8fa2d3a

Browse files
committed
Avoid over-linking
1 parent 1eae014 commit 8fa2d3a

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Diff for: documentation/markup.rst

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ external links ```Link text <https://example.com>`_`` :ref:`hyperl
3030
roles w/ custom text ``:role:`custom text <target>``` :ref:`roles`
3131
roles w/ only last part ``:role:`~hidden.hidden.visible``` :ref:`roles`
3232
roles w/o link ``:role:`!target``` :ref:`roles`
33+
roles w/o link, short ``:role:`~!hidden.hidden.visible``` :ref:`roles`
3334
issues ``:gh:`ID```, ``:issue:`ID``` :ref:`roles`
3435
CPython source ``:source:`PATH``` :ref:`roles`
3536
comments ``.. a comment`` :ref:`comments`

Diff for: documentation/style-guide.rst

+27-1
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,37 @@ explanation.
124124
provide context, make connections between topics, and discuss alternative
125125
opinions. There is no section dedicated to explanations but these can be
126126
found throughout Python's documentation, for example the
127-
:ref:`python:unicode-howto`
127+
:ref:`python:unicode-howto`.
128128

129129
Please consult the `Diátaxis <https://diataxis.fr/>`_ guide for more
130130
detail.
131131

132+
Links
133+
=====
134+
135+
Linking words to more information about those words is a powerful tool for
136+
helping people navigate documentation, but links can be over-used.
137+
138+
Links should be provided only if they help the user. If a link will not help
139+
the user, do not create a link. You may need to suppress a link that Sphinx
140+
would have created automatically.
141+
142+
Generally, a link should be provided for the first use of a term in a unit This
143+
is not a hard and fast rule. Sometimes the second mention is a more
144+
appropriate jumping off point. Some units are long enough to have a few
145+
repeated links. Use judgement to decide if a link would help the reader.
146+
147+
Do not use a link when the link would point to the current unit. It's natural
148+
to use the name of a function in the documentation for the function, but a link
149+
on that function name that simply reloads the section the user is already
150+
reading is useless and distracting.
151+
152+
Sphinx provides ways to automatically add links to references, and a way to
153+
suppress the link. Using roles like ``:func:`map``` will link to the
154+
documentation for ``map``. You can suppress the link while keeping the
155+
semantic presentation of the function name by adding an exclamation point
156+
prefix: ``:func:`!map```.
157+
132158
Affirmative tone
133159
================
134160

0 commit comments

Comments
 (0)