Repository navigation
fix(docs): follow the configured site slugifier and toc id rules in the docs-check parser - #958
Merged
Merged
Conversation
…he docs-check parser Take the shared-parser change merged in cubrid-lab/cubrid-cookbook-python#402 and cubrid-lab/pycubrid#976: read this repository's mkdocs.yml to choose the site slugifier (still pymdownx.slugs here) and allocate site ids as the toc extension's unique() does, so an empty slug becomes _1 and a taken _N is incremented. Ordinary anchors are unchanged. Port the tests. Refs #957 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes preserve existing callers and include regression coverage for the corrected behavior, with no unresolved findings.
0 open findings
What changed in this PR
Aligns the shared documentation parser with the configured MkDocs slugifier and Python-Markdown’s anchor collision rules.
Changes:
- Detects the configured site slugifier while preserving ordinary anchors.
- Corrects empty and duplicate site IDs.
- Adds regression coverage and an Unreleased changelog entry.
| File | Description |
|---|---|
| test/test_check_docs_links.py | Tests slugifier selection and anchor collision handling. |
| scripts/_markdown.py | Detects site configuration and applies toc ID allocation rules. |
| CHANGELOG.md | Documents the parser corrections. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
Status for head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
This brings in the shared docs-check parser change from cubrid-cookbook-python, already applied in pycubrid.
scripts/_markdown.pynow reads this repository'smkdocs.ymland uses the slugifier it configures, which ispymdownx.slugshere, as before. It also allocates site ids the way Python-Markdown'stocextension (itsunique()function) does:_1, where it used to get an empty id;_Nis incremented, so_1is followed by_2, not_1_1.Ordinary headings keep their anchors.
Why
The shared functions should stay identical across the three copies (Refs cubrid-lab/cubrid-cookbook-python#388, merged as cubrid-lab/cubrid-cookbook-python#402 and cubrid-lab/pycubrid#976). The
toccollision rule also corrects this repository's own results for the two edge cases above.Alternative not chosen
Keeping this copy as it was. Results would match for every current page, but the copies would drift. The cookbook-only fix would also leave the empty-slug and
_Ncases wrong here.Changes
scripts/_markdown.py: the cookbook patch applied unchanged.default_site_slug(),site_slugifier()and_site_unique().parse()gains an optionalsite_slugargument and defaults to the slugifier this repository configures.test/test_check_docs_links.py: the cookbook's new tests, withREPO_SITE_SLUG = _markdown._site_slugfor this repository, plusimport re.CHANGELOG.md: an Unreleased CI entry.Known differences / Not changed
mkdocs.ymlor to the site.Validation
pytest test/test_check_docs_links.py: 152 passed, with Markdown installed (148 passed, 4 skipped without it).python scripts/check_docs_links.py(74 Markdown files) andcheck_agents_docs.py: OK._REPO_SITE_SLUGresolves to_site_slug, thepymdownx.slugsslugifier.ruff checkandruff format --check: clean.python scripts/lint_changelog.py: OK.Refs #957
🤖 Generated with Claude Code