Skip to content

improvement(docs): clean up leftovers from the code-block alignment PR - #6825

Merged
waleedlatif1 merged 2 commits into
stagingfrom
docs/codeblock-cleanup
Aug 18, 2026
Merged

improvement(docs): clean up leftovers from the code-block alignment PR#6825
waleedlatif1 merged 2 commits into
stagingfrom
docs/codeblock-cleanup

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #6810. That PR went through several revisions and a couple of reverted approaches; this clears the residue they left behind. No rendering changes — comments, one dead CSS rule, one dead call, and two emcn reuses.

  • Removes a highlighter registration that can never fire. fumadocs-openapi calls renderCodeBlock with a hard-coded "json" from both call sites (request-tabs.js:76, response-tabs.js:48), so the docs CodeBlock never receives a shell language and the shell-scoped JSON-body injection could never apply there. The getHighlighter call was pure overhead on every API sample render.
  • Corrects the grammar's stated coverage. It applies to prose fences only, via langs. Both API reference paths are unreachable — request/response samples are JSON, and the cURL usage tabs highlight client-side off fumadocs' own factory.
  • Removes a dead CSS rule — the copy-button svg sizing rule sized an element a later rule sets display: none on, ungated. Superseded by the mask approach.
  • Fixes comments that had gone false as the code moved: page.tsx still argued about a Shiki factory that was deleted; global.css's section header claimed the component owns the shell while the next rule defines it there; code-block.tsx said API samples bypass it when they route through it; getCode's TSDoc gave a reason (line numbers leaking into the clipboard) that cannot happen, since the gutter is a ::before and pseudo-element content never reaches textContent.
  • Qualifies the --copy-glyph rules with the :has(> svg[class*="lucide"]) the group's own comment asserts of every rule in it.
  • Composes chipGeometryClass and ChipChevronDown from @sim/emcn instead of restating their literals, per chip-chrome.ts's "never re-derive the literal; import it".
  • Notes two upstream constraints so they aren't rediscovered: fumadocs ships its own gutter for lines-meta fences that cannot be suppressed from here, and biome's noDuplicateProperties is why the tablist hover rule stays a separate block rather than a nested @variant.

Type of Change

  • Improvement

Testing

Production build passes (EXIT=0, 4366 pages). bun run lint:check, bun run type-check, and check:audits (29 audits) all pass. Client bundle unchanged from the state Vercel accepted on #6810json-schema-ts in 0 chunks.

Every claim in the new comments was verified against source rather than assumed: the renderCodeBlock call sites, the ClientCodeBlockProvider export map, the biome rule behaviour, and the --code-surface / --code-gutter consumer counts.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

A cleanup pass over the final state. Every finding was residue from an approach
this PR tried and abandoned, or a claim that stopped being true when it did.

- Delete the copy-button svg sizing rule: a later rule sets `display: none` on
  that same element ungated, so sizing it was never observable. Superseded by
  the mask approach.
- Drop the paragraph in page.tsx arguing about a custom Shiki factory. The
  factory was deleted; nothing configures one now.
- Correct shiki-curl-json.ts, which still claimed the grammar "reaches the
  client path too". It does not — that was the justification for choosing a
  grammar over a transformer, so leaving it stated the opposite of the truth.
  Now records where it applies, where it does not, and why not to retry.
- Correct the global.css section header, which claimed the component owns the
  shell while the next rule defines it here.
- Qualify the `--copy-glyph` declarations with `:has(> svg[class*="lucide"])`,
  which the group's own comment asserts of every rule in it.
- Correct `getCode`'s TSDoc: the gutter is a `::before`, and pseudo-element
  content never reaches `textContent`, so line numbers were never what the
  clone guards. It guards transformer-emitted `.nd-copy-ignore` nodes.
- Compose `chipGeometryClass` and emcn's `ChipChevronDown` in the API example
  selector instead of restating their literals.
- Merge the duplicated `div[role="region"]` rule. The tablist pair stays split:
  biome's `noDuplicateProperties` reads a nested `@variant` setting the same
  property as a duplicate and fails the build — recorded so it is not remerged.
- Note that fumadocs ships its own gutter for `lines`-meta fences, which cannot
  be suppressed from here and would paint a second column.
fumadocs-openapi calls `renderCodeBlock` with a hard-coded `"json"` from both of
its call sites (`request-tabs.js:76`, `response-tabs.js:48`), so the docs
`CodeBlock` it routes through never receives a shell language. The
`getHighlighter('js', { langs: [curlJsonBodyGrammar] })` registering the
shell-scoped JSON-body injection therefore did nothing but await on every API
sample render, and the docblock claiming the grammar covers those samples was
wrong.

- Delete the call and its imports.
- State the grammar's real coverage: prose fences only, via `langs`. Both API
  reference paths are unreachable — samples are JSON, and the cURL usage tabs
  highlight client-side off fumadocs' own factory.
- Correct `code-block.tsx`'s TSDoc, which still said API samples come from
  fumadocs' own renderer. They come through this component; `UsageTab` is the
  renderer that bypasses it.
- Re-home a comment orphaned when two CSS rules merged — it had drifted onto
  the rule below and read as documenting it.
- Drop a `.nd-copy-ignore` claim about transformers emitting those nodes;
  nothing here does, and upstream parity is the reason the clone exists.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 18, 2026 10:20pm

Request Review

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation, comments, and dead-code removal in docs styling with no behavioral or security-sensitive changes; emcn imports are cosmetic consistency.

Overview
Follow-up cleanup after the docs code-block alignment work. No intended rendering changes — comments, dead CSS, a no-op highlighter call, and two emcn reuses.

page.tsx drops getHighlighter and the curlJsonBodyGrammar import from ApiCodeBlock. API samples use hard-coded "json" from fumadocs-openapi, so shell-scoped JSON injection never applied there; the registration was overhead on every API sample render.

global.css updates the code-block section header so shell chrome lives in CSS (three renderers, not only code-block.tsx). Removes dead copy-button SVG sizing (superseded by mask + display: none). Qualifies --copy-glyph rules with :has(> svg[class*="lucide"]). Consolidates viewport padding-block and documents why the tablist hover rule stays separate (biome noDuplicateProperties).

code-block.tsx and shiki-curl-json.ts fix comments: API path through this component, copy logic vs ::before gutters, and grammar scope (prose MDX only, not API reference).

api-example-selector.tsx uses chipGeometryClass and ChipChevronDown from @sim/emcn instead of duplicated literals.

Reviewed by Cursor Bugbot for commit 7741da6. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR removes unreachable highlighter registration and consolidates documentation code-block cleanup without intended rendering changes.

  • Removes the unused shell-language grammar registration from API sample rendering.
  • Narrows copy-glyph selectors and consolidates a duplicate viewport rule.
  • Reuses shared EMCN chip geometry and chevron components.
  • Corrects comments describing code-block rendering and highlighting boundaries.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/docs/app/[lang]/[[...slug]]/page.tsx Removes the unused highlighter import, grammar import, and registration call from API code-block rendering.
apps/docs/app/global.css Consolidates duplicate viewport declarations, removes dead SVG sizing, narrows copy-glyph selectors, and updates explanatory comments.
apps/docs/components/ui/api-example-selector.tsx Replaces re-derived chip geometry and chevron styling with shared EMCN exports.
apps/docs/components/ui/code-block.tsx Updates documentation to reflect the current render paths and clipboard behavior.
apps/docs/lib/shiki-curl-json.ts Clarifies that the custom grammar applies only to prose fences and documents API-renderer constraints.

Reviews (2): Last reviewed commit: "fix(docs): drop a highlighter registrati..." | Re-trigger Greptile

Comment thread apps/docs/app/global.css
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7741da6. Configure here.

@waleedlatif1
waleedlatif1 merged commit 3ff91f0 into staging Aug 18, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the docs/codeblock-cleanup branch August 18, 2026 22:28
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