mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:05:54 +01:00
[PR #29] [MERGED] OLD-7872: test_docs_links strips code fences line by line, as CommonMark does #83
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#83
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/29
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:docs-links-fences📝 Commits (1)
ce560e0tests: test_docs_links reads code fences line by line, as CommonMark does📊 Changes
1 file changed (+76 additions, -3 deletions)
View changed files
📝
tests/test_docs_links.py(+76 -3)📄 Description
Claimed in the coordination issue as: OLD-7872 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964)
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🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.