fix(docs): repair anchor broken by em-dash-to-hyphen sweep - #245
Open
marcelo-maciel wants to merge 1 commit into
Open
fix(docs): repair anchor broken by em-dash-to-hyphen sweep#245marcelo-maciel wants to merge 1 commit into
marcelo-maciel wants to merge 1 commit into
Conversation
commit a96478c replaced all em dashes with hyphens site-wide, which changed the github-slugger output for headings containing em dashes (the slugger drops em dashes but keeps hyphens, so hyphen count in the slug changes). The link to the "Chat - the realtime showcase" heading in dashboard.mdx still pointed at the old two-hyphen slug and silently broke, since astro check does not validate in-content anchors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Commit a96478c (
style: replace all em dashes with hyphens across the site) replaced every em dash (—) with a hyphen (-) site-wide.github-slugger(the same library Astro/Starlight use to generate heading anchors) drops em dashes entirely when slugging, but keeps hyphens as-is. That means the sweep silently changed the anchor for any heading that contained an em dash:Chat — the realtime showcase(before)chat--the-realtime-showcase(2 hyphens)Chat - the realtime showcase(after)chat---the-realtime-showcase(3 hyphens)Any internal link pointing at the old slug broke silently.
astro checkdoes not validate anchors inside link targets, so it passed with 0 errors both before and after the sweep, on both the broken and fixed link.Fix
src/content/docs/frontend/architecture.mdxlinked to the "Chat - the realtime showcase" heading indashboard.mdxusing the pre-sweep slug. Updated the link to the current slug. The heading text itself is untouched, so the public heading and its URL fragment stay consistent with the rest of the post-sweep site (no new em dash introduced).Verification method
src/content/docs, computes slugs per file with the site's actualgithub-sluggerdependency, and resolves every internal anchor link against them) to also cover same-file relative anchors (](#anchor)), not just cross-file ones (](/docs/route#anchor)). Total anchor-bearing links found across the site: 5. Before the fix, 1 was broken (the one described above); after, 0.github-sluggeragainst the original em-dash heading text (Chat — the realtime showcase) and confirmed it produced byte-for-byte the same anchor (chat--the-realtime-showcase) that was in the broken link. Only after that check matched did I trust the slugger's output for the new heading text.npx astro check-> 0 errors, 0 warnings (21 pre-existing hints, unrelated to this change).Scope
Single link fix, no heading text changed (would break the public URL and any external link), no prose rewritten. Not touching
npm run build, which fails inbuildEndfetching a font fromfonts.gstatic.com— same failure on unmodifiedmain, unrelated to this change.