Skip to content

Commit

Permalink
Refs #32720 -- Added configuration for Sphinx linkcheck builder.
Browse files Browse the repository at this point in the history
Note that we explicitly ignore checking anchors for line-range anchors
on GitHub which are dynamically generated and, otherwise, show up as
broken links.

See sphinx-doc/sphinx#7388 (comment).

We also ignore links to resources that require authentication.
  • Loading branch information
ngnpope committed May 6, 2021
1 parent 4f09d70 commit 0663484
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/conf.py
Expand Up @@ -50,6 +50,28 @@
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2

# Linkcheck settings.
linkcheck_ignore = [
# 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+)?/',
# Ignore 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',
# Ignore 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',
# Ignore 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:
Expand Down

0 comments on commit 0663484

Please sign in to comment.