OLD-7872: test_docs_links strips code fences line by line, as CommonMark does #29
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!29
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/29/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ItsMrDubey on GitHub · 2026-11-24 02:02 UTC · original
ItsMrDubey:docs-links-fences→main· +76 −3 · 1 files · 1 commits · merged 2026-11-24 02:26 UTCClaimed in the coordination issue as: OLD-7872 (#14)
What and why
Old #7872 (ray3242):
strip_fences()intests/test_docs_links.pyusedre.compile(r"```.*?```", re.S), which pairs any two triple-backtick runs. An inline```in prose, a 4-backtick fence holding a 3-backtick one, a~~~fence, or a closing line with an info string all mis-pair it: text between unrelated fences was dropped, so real headings vanished from the anchor set and links in that text went unchecked.strip_fences()is now a line-based scanner following CommonMark: a fence opens on a line indented at most 3 spaces past its list item's content column (so the 4-space fences nested in list items in the i18n quickstarts still count), with >=3 backticks (no backtick in the info string) or tildes; it closes on a line of the same character, at least as long, with nothing after it; an unclosed fence runs to the end of the page. CRLF input is handled.No other test or tool carries the regex. The other
tests/test_docs_*.pycheckers use a separateline.lstrip().startswith("```")toggle; I left those alone because they do a different job and this issue does not cover them.New
StripFencesTestcases cover inline backticks, a longer fence holding a shorter one, tilde fences, closing lines with an info string, fences nested in list items, 4-space indent outside a list, an unclosed fence, CRLF, and a heading after inline backticks showing up as an anchor.On the real docs, the old and new scanners give identical link and anchor sets for every tracked
.mdfile, so no doc links needed fixing.Tested
Windows 11, Python 3.11.9, no GPU needed.
python -I tests/test_docs_links.py: before 7 tests OK; after 16 tests OK.StripFencesTestrun against the oldstrip_fences: 7 of 9 fail (the bug reproduces); all pass with the new one.links()/anchors()over all tracked Markdown: no differences.python -I tests/test_ci_registration.py,tests/test_docs_repo_paths.py,tests/test_runtime_paths.py: OK.python -I scripts/check_no_game_data.py tests/test_docs_links.py: clean.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. n/a: no translator rule