Skip to content

Suggest case-insensitive matches in anchor validation warnings - #83

Merged
shenxianpeng merged 3 commits into
mainfrom
claude/mkdocs-issue-4167-15dhse
Aug 12, 2026
Merged

shenxianpeng merged 3 commits into
mainfrom
claude/mkdocs-issue-4167-15dhse

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Anchor validation compares anchors case-sensitively, which is correct (URL fragments are case-sensitive), but the warning gave no hint when the only problem was letter case — e.g. linking to #Conflicts when the heading generated #conflicts. Users were left wondering why an anchor that visibly exists was reported as missing.

When a link's anchor is not found but one or more anchors on the target page match it case-insensitively, the warning now appends a hint:

WARNING - Doc file 'foo.md' contains a link 'index.md#Headline-Tab-A', but the doc
          'index.md' does not contain an anchor '#Headline-Tab-A'. Note: anchor
          comparison is case-sensitive; did you mean '#headline-tab-a'?

The hint applies to both same-page and cross-page links. When no case-insensitive match exists, the message is unchanged, and the existing footnote hint is preserved.

While working on this I also re-verified upstream issue mkdocs/mkdocs#3690 (anchor validation false positives with late-generated IDs, e.g. pymdownx.tabbed with combine_header_slug): it was already fixed in this fork by #34 (extractor priority lowered to run after all extensions), and I confirmed with builds covering tabbed (both styles), raw-HTML anchors, attr_list custom IDs and toc permalinks — no false positives remain, so no further code change was needed for it.

Additionally, this PR fixes a CI failure that started on 2026-08-12 and also affects main: the macos-latest smoke test job fails during hatch's "Syncing environment plugin requirements" step with ValueError: Unknown environment collector: mkdocs. Installing hatch-mkdocs explicitly alongside hatch makes the environment collector importable directly, bypassing the plugin-requirement sync that broke on the macOS runner.

Related Issue

Addresses upstream mkdocs/mkdocs#3703; verifies upstream mkdocs/mkdocs#3690 (already fixed by #34).

Checklist

  • New tests added for new behavior (if applicable)
  • Documentation updated (if applicable) — warning text is self-documenting; no config changes
  • Release notes docs/about/release-notes.md updated (if applicable)

🤖 Generated with Claude Code

https://claude.ai/code/session_018Hw7x9BxxpuKiLkzjLczp9

Anchor validation compares anchors case-sensitively, which is correct
(URL fragments are case-sensitive), but the warning gave no hint when
the only problem was letter case - e.g. linking to '#Conflicts' when
the heading generated '#conflicts'. Users were left wondering why an
anchor that visibly exists was reported as missing.

When a link's anchor is not found but one or more anchors on the target
page match it case-insensitively, the warning now appends:

    Note: anchor comparison is case-sensitive; did you mean '#conflicts'?

The hint applies to both same-page and cross-page links.

Also verified (with regression coverage already in place) that anchors
generated late by Markdown extensions, such as pymdownx.tabbed with
'combine_header_slug', are no longer reported as missing.

Addresses upstream issues mkdocs/mkdocs#3703 and mkdocs/mkdocs#3690.
Since 2026-08-12 the macos-latest smoke test job fails during hatch's
'Syncing environment plugin requirements' step with:

    ValueError: Unknown environment collector: mkdocs

The failure also occurs on main and is unrelated to any code change.
Installing hatch-mkdocs into the same environment as hatch makes the
environment collector importable directly, bypassing the plugin
requirement sync that broke on the macOS runner.
@shenxianpeng
shenxianpeng merged commit 9d45c3b into main Aug 12, 2026
21 checks passed
@shenxianpeng
shenxianpeng deleted the claude/mkdocs-issue-4167-15dhse branch August 12, 2026 11:02
@shenxianpeng shenxianpeng added the enhancement New feature or request label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant