Skip to content

Scope docs heading anchors under each subcommand section - #4079

Merged
max-sixty merged 2 commits into
mainfrom
fix-prune-branch-age
Sep 12, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix-prune-branch-age

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Command pages on the site append every subcommand's help, so headings such as "Examples", "Options", and "Command reference" repeat down /step/ and /config/. The heading-id plugin numbered the repeats by position (/step/#examples-3, /step/#hooks-1, /step/#command-reference-7), so an anchor pointed somewhere else once a same-named heading was added above it.

docs/src/plugins/stable-heading-ids.mjs now scopes ids below each subcommand's H2 (a heading starting wt ) by that section's id: "Examples" under wt step push is /step/#wt-step-push--examples. Page-level headings and the subcommand headings keep their ids, so the table of contents and links like /step/#wt-step-copy-ignored are unchanged. A slug never contains --, so a scoped id can't equal another heading's slug — a "Cache" heading under wt config state stays distinct from the wt config state cache section.

With the site handling it, the CLI help keeps unqualified headings. #4000 renamed six wt config subcommand headings to "Approval examples", "Alias examples", and so on to avoid the numbering; they're back to "Examples", in --help as well.

Every anchor inside a subcommand section changes once: /step/#min-age-guard is now /step/#wt-step-prune--min-age-guard. The two internal links that pointed at such anchors — the FAQ's copy-on-write link and wt config approvals' "Reading approval state" — are updated, and test:site checks every internal fragment. External links to the old anchors land at the top of the page.

The search-index plugin (pagefind-command-references.mjs) now imports the subcommand-heading check from the heading-id plugin rather than keeping its own copy.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

https://claude.ai/code/session_01HUmx2Jd5mTK5TznqGDmLGp

max-sixty and others added 2 commits September 12, 2026 16:42
Command pages append every subcommand's help, so headings like "Examples"
and "Command reference" repeat, and the site numbered their anchors
(#examples-3) by position, shifting them whenever a section was added.
The heading-id plugin now prefixes ids below a `wt …` H2 with that
section's id (#wt-step-push--examples), so the CLI help keeps unqualified
headings. The six `wt config` "<Noun> examples" renames that worked around
the numbering go back to "Examples".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUmx2Jd5mTK5TznqGDmLGp
@max-sixty
max-sixty merged commit 1031534 into main Sep 12, 2026
40 checks passed
@max-sixty
max-sixty deleted the fix-prune-branch-age branch September 12, 2026 23:57
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