Skip to content

docs: add derived-id section reference lint - #4340

Merged
BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:docs-anchor-lint
Aug 5, 2026
Merged

docs: add derived-id section reference lint#4340
BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:docs-anchor-lint

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Companion to #4339 (independent, either merge order).

Sections linked via auto-generated AsciiDoc ids (<<_normal_download>> xrefs, link:...html#_ini_settings[...] URLs) break in translated docs when the section title is translated, because asciidoctor derives the id from the title text. #4339 pins the five targets that are broken in translations today. This PR makes sure the pattern does not regrow.

scripts/docs-anchor-check.py does two passes over docs/src: collect every explicit anchor definition ([[id]], [#id], id=, anchor:id[]), then report each <<_derived>> xref or #_derived link URL whose target is not explicitly defined. Namespaced anchors all carry a colon by convention, so a _-prefixed target with no colon is a derived id.

It is wired warn-only into the htmldocs CI job (same pattern as htmlcheck.sh -w), printing offenders with file:line and writing the list to the GHA job summary. Flip to --enforce once the tree is clean and the check has had a burn-in.

Also included: explicit anchors for the remaining lint hits, all same-page links in untranslated man pages (_subcommands in linuxcncrsh.1, _mbccs_file_format, _modbus_functions, _modbus_types, _hal_types in mesambccc.1). The explicit ids match the previously auto-generated ones, so rendered output is unchanged; I verified the ids in the built HTML.

Current lint output on this branch is exactly the five references pinned by #4339, so the check turns clean as soon as that PR lands.

@grandixximo
grandixximo force-pushed the docs-anchor-lint branch 2 times, most recently from e0f2541 to b3b04bf Compare August 5, 2026 04:06
@grandixximo

grandixximo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

this looks like this now:

image

Acceptable? or keep the warning only in the annotations, and remove the summary from here??

scripts/docs-anchor-check.py, wired into the htmldocs CI job with
--enforce, flags <<_derived>> xrefs and link:...html#_derived URLs
whose target has no explicit [[anchor]] in docs/src. Derived ids come
from section titles, so such references break when a title is
translated or retitled. Pin the target with an explicit anchor
instead. The lint reads only the English sources, so translations
cannot trip it.

Also pins the remaining lint hits, all same-page links in untranslated
man pages (_subcommands, _mbccs_file_format, _modbus_functions,
_modbus_types, _hal_types). Explicit ids match the auto-generated
ones, so output is unchanged. With the five anchors from LinuxCNC#4339 merged,
the lint reports the tree clean.
@grandixximo

Copy link
Copy Markdown
Contributor Author

Tested as working without --enforce before merging of #4339, see the picture in my previous comment.
I pushed the enforced version now that #4339 is merged, tree is clean, and merging this will prevent the entire fault variant to enter in tree and trickle down to the translations.

BTW I also cleaned up the rest of the html broken links warnings coming from the translations in weblate, not sure when those will gurgle up, after that we shall have a squeaky clean tree (insert here humorous comment).

@BsAtHome

BsAtHome commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

(insert here humorous comment).

So clean the birds will refuse to sit on the branches of the tree and silence was heard.

@BsAtHome
BsAtHome merged commit 9d52bb1 into LinuxCNC:master Aug 5, 2026
16 checks passed
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.

2 participants