Validate inline code highlight metadata in CI - #8645
Merged
aurorascharff merged 2 commits intoSep 8, 2026
Conversation
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
aurorascharff
marked this pull request as ready for review
September 8, 2026 12:51
eps1lon
approved these changes
Sep 8, 2026
eps1lon
left a comment
Member
There was a problem hiding this comment.
Immediate PTSD when thinking about how much time I spent getting these highlight tupples right.
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.
Summary
Invalid inline code highlight metadata currently throws from
CodeBlockat runtime, which can leave an otherwise valid documentation page showing a client-side application error. This happened after #8520 moved<form action={submitAction}>from line 23 to line 25 without updating its highlight metadata. The broken Server Functions page was reported in #8523 and fixed separately in #8531.This PR extends the existing Markdown ESLint rule to validate inline code highlights before deployment. It checks that:
fromIndex.The validator uses the normalized metadata produced by the Markdown parser, matching what MDX passes to
CodeBlockand supporting highlights that contain escaped quotes. Regression fixtures cover valid metadata, missing text, and out-of-bounds lines. The local-rule tests now run as part ofci-check.Testing
yarn test:eslint-local-rulesyarn eslint "src/content/**/*.md"yarn ci-checkTo verify the regression, I temporarily changed the Server Functions example's valid
submitActionhighlight from line 25 to line 24.ci-checkfailed with:After restoring line 25, the complete
ci-checkpassed.