docs: keep translated link targets in sync - #26
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b844d7a705
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def _markdown_link_targets(page: Path) -> Counter[str]: | ||
| return Counter( | ||
| re.findall( | ||
| r"(?<!!)(?<!\\)\[[^\]\n]+\]\(([^)\s]+)(?:\s+\"[^\"]*\")?\)", |
There was a problem hiding this comment.
Include reference-style destinations in the parity check
On pages using reference-style links, such as docs/index.md ([PEP 750] and [Babel]) and docs/comparison.md, this regex only collects inline [text](target) destinations. A translated page can therefore change or remove a [label]: target definition—leaving its rendered link broken or misdirected—while this test still passes. Parse or collect reference definitions as well so the new parity check covers the link targets already present in the documentation.
Useful? React with 👍 / 👎.
Summary
spec.mdlink target in five translatedindex.mdpages.Validation
uv run pytest tests/test_docs.pyuv run ruff check .uv run ruff format --check .git diff --check HEAD~1..HEADFixes #24