Skip to content

chore(docs): pin an explicit id on every heading - #4742

Open
thetaPC wants to merge 4 commits into
mainfrom
pinned-anchors
Open

thetaPC wants to merge 4 commits into
mainfrom
pinned-anchors

Conversation

@thetaPC

@thetaPC thetaPC commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Issue URL: internal

What is the current behavior?

A heading's anchor is derived from its text, so translating the heading silently moves the anchor and every English-authored link to it dies. One unpinned heading, ## Virtual Properties, is currently responsible for 103 broken anchors on the Japanese site. None of this shows up in review, because ja never builds in PR previews.

The same applies in English whenever a heading is renamed. Nearly every broken anchor fixed in #4736 was a heading someone renamed years ago, #text-alignment to #text-align and so on.

Only 52 of the roughly 2,400 headings in docs/ carried an explicit id.

What is the new behavior?

Every h2 through h6 in the current tree carries one, following Docusaurus's own docs and Vue, which both pin the id in the English source so a translation copies it verbatim.

  • 2,434 hand-authored headings across 237 files, generated with docusaurus write-heading-ids --syntax mdx-comment rather than by hand.
  • 738 generated headings, 629 in native and 109 in cli/commands. Both scripts now call writeMarkdownHeadingId on the assembled content before writing, so generated pages follow the same rules instead of a second implementation that could drift.
  • @docusaurus/utils promoted from a transitive dependency to a declared one, matching how the repo already declares every other Docusaurus subpackage it imports. One line in the lockfile, no re-resolution.

h1 headings are excluded by the tool itself, since Docusaurus generates no anchors for them.

Does this introduce a breaking change?

  • Yes
  • No

Other information

N/A

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Sep 18, 2026 10:22pm UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review September 18, 2026 22:25
@thetaPC
thetaPC requested a review from a team as a code owner September 18, 2026 22:25
@thetaPC
thetaPC requested a review from ShaneK September 18, 2026 22:25
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.

1 participant