check_anchors.py's module docstring says mkdocs build --strict "does not
validate anchors at all". That was true before mkdocs 1.6. It is not true now,
and both consuming repos are on mkdocs 1.6.1.
Setting
validation:
links:
anchors: warn
makes mkdocs build --strict fail on a broken fragment. Measured:
- On
halos-org/docs, adding [Broken](index.md#no-such-heading-here) to
docs/index.md produces exactly one warning and aborts the strict build. No
other warning appears, so the existing content is clean under it, and
print_page/ needs no exclusion — mkdocs validates source markdown, not
generated output.
- On a two-page, one-locale probe with
mkdocs-static-i18n, a fragment in
docs/fi/second.md pointing at a heading absent from docs/fi/index.md is
caught the same way. The cross-locale case that motivated check-anchors is
covered.
The remaining unique coverage of check-anchors is links mkdocs does not parse
from source: root-absolute markdown links, and raw HTML <a href>. Counted
across both repos:
|
halos-org/docs |
hatlabs/halpi2 |
| markdown links carrying a fragment |
20 |
530 |
| of those, root-absolute |
0 |
0 |
| raw HTML anchor links |
0 |
0 |
So today check-anchors catches nothing in either repo that the config line
would not, while costing a dependency and a --exclude 'print_page/*' argument
that exists only because it reads generated output.
It is not strictly redundant — it checks the built site, so it would catch a
theme or plugin emitting a dead fragment, and root-absolute links if either repo
ever writes one. But the docstring's justification is stale and the value is
much smaller than it claims.
Decide one of:
- Keep it, correct the docstring, and recommend
validation.links.anchors in
the README as the cheap first line of defence.
- Keep it only for the built-site cases mkdocs cannot see, and document that
narrower purpose.
- Drop it, and have consuming repos set the config line instead.
check_anchors.py's module docstring saysmkdocs build --strict"does notvalidate anchors at all". That was true before mkdocs 1.6. It is not true now,
and both consuming repos are on mkdocs 1.6.1.
Setting
makes
mkdocs build --strictfail on a broken fragment. Measured:halos-org/docs, adding[Broken](index.md#no-such-heading-here)todocs/index.mdproduces exactly one warning and aborts the strict build. Noother warning appears, so the existing content is clean under it, and
print_page/needs no exclusion — mkdocs validates source markdown, notgenerated output.
mkdocs-static-i18n, a fragment indocs/fi/second.mdpointing at a heading absent fromdocs/fi/index.mdiscaught the same way. The cross-locale case that motivated
check-anchorsiscovered.
The remaining unique coverage of
check-anchorsis links mkdocs does not parsefrom source: root-absolute markdown links, and raw HTML
<a href>. Countedacross both repos:
halos-org/docshatlabs/halpi2So today
check-anchorscatches nothing in either repo that the config linewould not, while costing a dependency and a
--exclude 'print_page/*'argumentthat exists only because it reads generated output.
It is not strictly redundant — it checks the built site, so it would catch a
theme or plugin emitting a dead fragment, and root-absolute links if either repo
ever writes one. But the docstring's justification is stale and the value is
much smaller than it claims.
Decide one of:
validation.links.anchorsinthe README as the cheap first line of defence.
narrower purpose.