Skip to content

fix(docs): follow the configured site slugifier and toc id rules in the docs-check parser - #958

Merged
yeongseon merged 1 commit into
mainfrom
fix/957-site-slugifier
Oct 16, 2026
Merged

yeongseon merged 1 commit into
mainfrom
fix/957-site-slugifier

Conversation

@yeongseon

Copy link
Copy Markdown
Contributor

What this PR does

This brings in the shared docs-check parser change from cubrid-cookbook-python, already applied in pycubrid. scripts/_markdown.py now reads this repository's mkdocs.yml and uses the slugifier it configures, which is pymdownx.slugs here, as before. It also allocates site ids the way Python-Markdown's toc extension (its unique() function) does:

  • a heading with an empty slug gets _1, where it used to get an empty id;
  • a taken id that ends in _N is incremented, so _1 is 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 toc collision 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 _N cases wrong here.

Changes

  • scripts/_markdown.py: the cookbook patch applied unchanged.
    • New functions: default_site_slug(), site_slugifier() and _site_unique().
    • parse() gains an optional site_slug argument and defaults to the slugifier this repository configures.
    • Apart from the header, the copy still differs from the cookbook's only by the shell-substitution fixes that the cookbook copy lacks.
  • test/test_check_docs_links.py: the cookbook's new tests, with REPO_SITE_SLUG = _markdown._site_slug for this repository, plus import re.
  • CHANGELOG.md: an Unreleased CI entry.

Known differences / Not changed

  • No change to mkdocs.yml or to the site.
  • The existing anchor tests pass unchanged.

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) and check_agents_docs.py: OK.
  • _REPO_SITE_SLUG resolves to _site_slug, the pymdownx.slugs slugifier.
  • ruff check and ruff format --check: clean.
  • python scripts/lint_changelog.py: OK.

Refs #957

🤖 Generated with Claude Code

…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>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@yeongseon

Copy link
Copy Markdown
Contributor Author

Status for head 29e00d7: Copilot round 1 (COMMENTED at this head) recommends approval with 0 open findings. CI Gate passes, and the advisory agent-review check passed when rerun. Merging by squash at this head.

@yeongseon
yeongseon merged commit 8a70c48 into main Oct 16, 2026
27 of 28 checks passed
@yeongseon
yeongseon deleted the fix/957-site-slugifier branch October 16, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants