mirror of
https://github.com/hanzoai/turborepo.git
synced 2026-10-30 19:44:51 +00:00
## Summary - Heading anchor IDs and TOC entries included text from inline JSX components (like `<ExperimentalBadge>`), producing anchors like `#boundaries-experimental` and cluttered TOC sidebars - Adds a rehype plugin (`rehype-strip-heading-jsx`) that runs between `remarkHeading` and `rehypeToc` in the fumadocs pipeline to strip JSX from heading IDs and TOC titles while preserving badge rendering in the heading itself - Removes brittle badge-specific workarounds from the link checker ## How it works The rehype plugin intercepts heading elements after `remarkHeading` sets IDs but before `rehypeToc` reads them: 1. Rewrites the heading `id` without JSX text content 2. Removes JSX elements from heading children (so `rehypeToc` produces clean TOC titles) 3. Serializes the removed JSX as a `data-heading-badges` attribute The `HeadingWithBadges` component reads this attribute and re-injects the badge components inline at render time. Badges appear in the heading but never reach the TOC or anchor ID. ## Testing Visit `/docs/reference/configuration` and verify: - Heading anchors are clean (e.g., `#affectedusingtaskinputs` not `#affectedusingtaskinputs-pre-release`) - TOC sidebar entries don't include badge text - Badges still render inline in the heading content - Blog posts with anchor links to badge headings still navigate correctly (`/blog/turbo-2-4`, `/blog/turbo-2-2-0`, `/blog/turbo-1-9-0`)