Skip to content

fix: include formatted text in heading anchor ids - #2579

Merged
vtushar06 merged 2 commits into
json-schema-org:mainfrom
drishtyraghav0001:fix/heading-slug-inline-code
Nov 11, 2026
Merged

vtushar06 merged 2 commits into
json-schema-org:mainfrom
drishtyraghav0001:fix/heading-slug-inline-code

Conversation

@drishtyraghav0001

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bugfix

Issue Number:

Screenshots/videos:

n/a, heading ids only. checked in the built html that the draft-06 release notes heading id now matches its TOC link

If relevant, did you update the documentation?

no

Summary

slugifyMarkdownHeadline was dropping every child that wasn't a plain string, so headings with inline code, bold, italic or links got cut-off ids and the TOC links didn't scroll anywhere. it now pulls text out of nested children recursively (strings, numbers, arrays, react elements, md nodes). the [#custom-id] fragment still works the same.

the two draft-06 release notes pages had hand written TOC links pointing at the old truncated ids, so I updated those 7 links to the new ids. I scanned all headings under pages/ and 19 ids changed, all headings with formatting in them. no other links in the repo pointed at the old ids.

added tests in cypress/components/slugifyMarkdownHeadline.cy.tsx and one in Headlines.cy.tsx. lint, typecheck, build and the full component suite pass locally.

Does this PR introduce a breaking change?

no. external deep links to the old truncated ids on those 19 headings would stop matching, but they were broken from the TOC anyway

Checklist

Comment thread lib/slugifyMarkdownHeadline.ts Fixed
Comment thread lib/slugifyMarkdownHeadline.ts Fixed
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview fe5b1de

@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (92f9c18) to head (fe5b1de).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2579   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           31        31           
  Lines          719       719           
  Branches       223       223           
=========================================
  Hits           719       719           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@drishtyraghav0001

Copy link
Copy Markdown
Contributor Author

@playlikeboy quick q. ids for quoted inline code keep the quotes now (...-with-"additionalproperties"), same as plain text headings already do. your example had them stripped, happy to change that if you prefer. I also updated the TOC links in the draft-06 release notes that pointed at the old cut off ids. does this look right to you?

@playlikeboy playlikeboy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Keeping quotes is definitely the right call since it stays consistent with how plain-text headings are slugified across the rest of the site. Tested locally and on the Cloudflare preview — all the TOC links scroll to the right headings now. Thanks for putting this together!

@vtushar06
vtushar06 requested a balanced review from Copilot October 23, 2026 10:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

shivaminfo1
shivaminfo1 previously approved these changes Nov 11, 2026

@shivaminfo1 shivaminfo1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @drishtyraghav0001, nice cleanup of the heading slug logic and solid test coverage. LGTM!

@vtushar06
vtushar06 dismissed shivaminfo1’s stale review November 11, 2026 17:49

Posted from the wrong account by mistake.

@vtushar06 vtushar06 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @drishtyraghav0001, nice cleanup of the heading slug logic and solid test coverage. LGTM!

@vtushar06
vtushar06 merged commit e3f2680 into json-schema-org:main Nov 11, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to review to Done in PR - Triage Group Nov 11, 2026

This branch was successfully deployed

1 active deployment
Preview — fe5b1dee Deployed Oct 22, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Headings with inline code or formatting produce truncated anchor IDs, breaking TOC and internal links

6 participants