summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-04-27 11:57:59 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-05-17 11:21:35 +0200
commit0851933cba7b40e22f5e424c95763dbc27c40aa9 (patch)
treedcef436438000127bdb9b3e38492d071888ca163 /docs/conf.py
parentc156e369553c75a30c78b8ed54a57b1101865105 (diff)
Fixed #32720 -- Added configuration and docs for Sphinx link checker.
We explicitly ignore checking anchors for line-range anchors on GitHub which are dynamically generated and, otherwise, show up as broken links. See https://github.com/sphinx-doc/sphinx/issues/7388#issuecomment-739961689. We also ignore links to resources that require authentication.
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 24934503c9..3166397e30 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -50,6 +50,28 @@ extensions = [
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2
+# Linkcheck settings.
+linkcheck_ignore = [
+ # Special-use addresses and domain names. (RFC 6761/6890)
+ r'^https?://(?:127\.0\.0\.1|\[::1\])(?::\d+)?/',
+ r'^https?://(?:[^/\.]+\.)*example\.(?:com|net|org)(?::\d+)?/',
+ r'^https?://(?:[^/\.]+\.)*(?:example|invalid|localhost|test)(?::\d+)?/',
+ # Pages that are inaccessible because they require authentication.
+ r'^https://github\.com/[^/]+/[^/]+/fork',
+ r'^https://code\.djangoproject\.com/github/login',
+ r'^https://code\.djangoproject\.com/newticket',
+ r'^https://(?:code|www)\.djangoproject\.com/admin/',
+ r'^https://www\.djangoproject\.com/community/add/blogs/',
+ r'^https://www\.google\.com/webmasters/tools/ping',
+ r'^https://search\.google\.com/search-console/welcome',
+ # Fragments used to dynamically switch content or populate fields.
+ r'^https://webchat\.freenode\.net/#',
+ r'^https://github\.com/[^#]+#L\d+-L\d+$',
+ r'^https://help\.apple\.com/itc/podcasts_connect/#/itc',
+ # Anchors on certain pages with missing a[name] attributes.
+ r'^https://tools\.ietf\.org/html/rfc1123\.html#section-',
+]
+
# Spelling check needs an additional module that is not installed by default.
# Add it only if spelling check is requested so docs can be generated without it.
if 'spelling' in sys.argv: