Skip to content

Commit 24b0b24

Browse files
authored
update the link guidance now that we suppress them automatically (#1762)
Also use linklint on the devguide itself.
1 parent 5a4dd49 commit 24b0b24

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from urllib.request import urlopen
44

55
extensions = [
6+
'linklint.ext',
67
'notfound.extension',
78
'sphinx.ext.extlinks',
89
'sphinx.ext.intersphinx',

documentation/style-guide.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,19 @@ the second mention is more appropriate for a link. Some units are long enough
193193
to have a few repeated links. Use judgement to decide when a link will help
194194
the reader.
195195

196-
Do not use a link when the link would point to the current unit. It's natural
197-
to use the name of a function in the documentation for the function, but a link
198-
on that function name that simply reloads the section the user is already
199-
reading is useless and distracting.
196+
We use the :pypi:`linklint Sphinx extension <linklint>` to suppress two kinds
197+
of excessive links: references in a section to itself and duplicate references
198+
in a paragraph. Previously, editors had to carefully use an exclamation mark
199+
in a Sphinx reference (``:func:`!map```) to prevent such links.
200200

201201
Do not use links in section headers. They distract from the title of the
202202
section. The term will be mentioned in the paragraph text and can be linked
203203
from there.
204204

205-
Sphinx provides ways to automatically add links to references, and a way to
205+
Sphinx automatically adds links to references, and provides a way to
206206
suppress the link. Using roles like ``:func:`map``` will link to the
207-
documentation for ``map``. You can suppress the link while keeping the
207+
documentation for ``map``. If automatic link suppression isn't enough,
208+
you can suppress the link while keeping the
208209
semantic presentation of the function name by adding an exclamation point
209210
prefix: ``:func:`!map```. See :ref:`roles` for more details.
210211

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
furo>=2022.6.4
22
jinja2
3+
linklint
34
sphinx-autobuild>=2024.9.19
45
sphinx-inline-tabs>=2023.4.21
56
sphinx-lint==1.0.2

0 commit comments

Comments
 (0)