Skip to content

Commit 9ebdc98

Browse files
authored
Merge pull request #9467 from tk0miya/9435_disable_rewrite_github_anchor
Fix #9435: linkcheck: Failed to check anchors in github.com
2 parents 60617cb + a35b009 commit 9ebdc98

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

CHANGES

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Dependencies
77
Incompatible changes
88
--------------------
99

10+
* #9435: linkcheck: Disable checking automatically generated anchors on
11+
github.com (ex. anchors in reST/Markdown documents)
12+
1013
Deprecated
1114
----------
1215

@@ -16,6 +19,8 @@ Features added
1619
Bugs fixed
1720
----------
1821

22+
* #9435: linkcheck: Failed to check anchors in github.com
23+
1924
Testing
2025
--------
2126

sphinx/builders/linkcheck.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,10 @@ def setup(app: Sphinx) -> Dict[str, Any]:
714714
app.add_event('linkcheck-process-uri')
715715

716716
app.connect('config-inited', compile_linkcheck_allowed_redirects, priority=800)
717-
app.connect('linkcheck-process-uri', rewrite_github_anchor)
717+
718+
# FIXME: Disable URL rewrite handler for github.com temporarily.
719+
# ref: https://github.com/sphinx-doc/sphinx/issues/9435
720+
# app.connect('linkcheck-process-uri', rewrite_github_anchor)
718721

719722
return {
720723
'version': 'builtin',

tests/roots/test-linkcheck/links.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Some additional anchors to exercise ignore code
1313
* `Complete nonsense <https://localhost:7777/doesnotexist>`_
1414
* `Example valid local file <conf.py>`_
1515
* `Example invalid local file <path/to/notfound>`_
16-
* https://github.com/sphinx-doc/sphinx#documentation
17-
* https://github.com/sphinx-doc/sphinx#user-content-testing
16+
* https://github.com/sphinx-doc/sphinx/blob/4.x/sphinx/__init__.py#L2
1817

1918
.. image:: https://www.google.com/image.png
2019
.. figure:: https://www.google.com/image2.png

tests/test_build_linkcheck.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def test_defaults_json(app):
6666
"info"]:
6767
assert attr in row
6868

69-
assert len(content.splitlines()) == 12
70-
assert len(rows) == 12
69+
assert len(content.splitlines()) == 11
70+
assert len(rows) == 11
7171
# the output order of the rows is not stable
7272
# due to possible variance in network latency
7373
rowsby = {row["uri"]: row for row in rows}
@@ -88,7 +88,7 @@ def test_defaults_json(app):
8888
assert dnerow['uri'] == 'https://localhost:7777/doesnotexist'
8989
assert rowsby['https://www.google.com/image2.png'] == {
9090
'filename': 'links.txt',
91-
'lineno': 20,
91+
'lineno': 19,
9292
'status': 'broken',
9393
'code': 0,
9494
'uri': 'https://www.google.com/image2.png',
@@ -102,10 +102,6 @@ def test_defaults_json(app):
102102
# images should fail
103103
assert "Not Found for url: https://www.google.com/image.png" in \
104104
rowsby["https://www.google.com/image.png"]["info"]
105-
# The anchor of the URI for github.com is automatically modified
106-
assert 'https://github.com/sphinx-doc/sphinx#documentation' not in rowsby
107-
assert 'https://github.com/sphinx-doc/sphinx#user-content-documentation' in rowsby
108-
assert 'https://github.com/sphinx-doc/sphinx#user-content-testing' in rowsby
109105

110106

111107
@pytest.mark.sphinx(

0 commit comments

Comments
 (0)