Repository navigation
Conversation
…their anchors (ItsNotRexed#7872) The regex ```.*?``` paired any two triple-backtick runs, including inline ```code``` and the inner fence of a four-backtick block, so text between real code blocks was dropped and its headings vanished from anchors(). Pair fences the CommonMark way instead: an opening run of 3+ backticks or tildes is closed only by a run of the same character at least as long, alone on its line; an unclosed fence runs to the end of the page.
|
Linux CPython 3.14 check: the full |
|
Tested One edge case: when AI-assisted. |
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
Tested on Windows 11 (26100), CPython 3.14.7, CPU only, no game files: pass.
- Up to date with
upstream/main(dde82f27e). - Ran
python -I tests/test_docs_links.py: new unit teststest_fences_pair_line_by_lineandtest_heading_after_inline_triple_backticks_keeps_its_anchorpass cleanly. - Resolved false-positive failure from unpatched
main:../runtime/README.md#a-600-frame-headless-guest-sceneanchor was erroneously reported asanchor not foundonmainbecause inline triple backticks knocked fence pairing out of step; with this PR, the anchor resolves correctly. (The only remaining failure in the suite is the pre-existing missing filedocs/gpu_test_results.md -> RX9070GRE.txtonmain). - Verified negative control: the old regex
```.*?```extracted headings from inside code comments/tilde blocks (# Inside tilde,# Inside a comment,# Never closed), whereas CommonMark line-by-line pairing strictly retains only valid document headings (# Before,## Between,### After). python -I -m compileall tests/test_docs_links.py: clean.python -I scripts/check_no_game_data.py tests/test_docs_links.py: clean (exit 0).git diff --check upstream/main...HEAD: clean.
AI-assisted.
devnull34
left a comment
There was a problem hiding this comment.
Verified via Claude Code (Opus 5.5): strip_fences() line-by-line fence pairing according to CommonMark rules correctly handles nested 4-backtick blocks, tilde blocks, inline backticks, and unclosed trailing fences. Note: The failure in test_every_relative_link_resolves reproduces on main due to an existing broken link in docs/gpu_test_results.md (gpu-test-results/RX9070GRE.txt from #6720). Constructive note: Adding \r? before $ in FENCE_CLOSE ensures direct invocations of strip_fences with raw CRLF strings cleanly match fence closures.
|
checked: #7935 | with: python -I -m unittest discover -s tests -p test_docs_links.py | on: Debian 13, Intel i7-8700, CPython 3.13.5, head 310c139, CPU only | result: the new tests pass; test_every_relative_link_resolves still fails on one link that is also broken on main@dde82f27e (docs/gpu_test_results.md -> gpu-test-results/RX9070GRE.txt, missing file); the dev-tools.md anchor failure from main is gone |
|
I tested this on Windows with Python 3.13.0 using |
Fixes #7872.
strip_fences()used the regex```.*?```, which pairs any two triple-backtick runs. An inline```code```or the inner fence of a four-backtick block knocks every later pair out of step. Text that sits between real code blocks then gets stripped, its headings drop out ofanchors(), and valid links show up asanchor not found.The checker now pairs fences line by line, following CommonMark:
Tests
test_fences_pair_line_by_line: a synthetic page with a nested 4-backtick fence, inline triple backticks, a tilde fence holding backticks, a fence with an info string and an unclosed fence. Only the three real headings survive. The old regex fails this test.test_heading_after_inline_triple_backticks_keeps_its_anchor: checks theanchors()path end to end.python -I tests/test_docs_links.pyon Windows, CPython 3.12:runtime/README.mdnow yieldsa-600-frame-headless-guest-scene, and the repository scan reports noanchor not found.CPU only, no game data, no GPU.