mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
improvement(docs): clean up leftovers from the code-block alignment PR (#6825)
* improvement(docs): clear leftovers from the reverted revisions
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.
* fix(docs): drop a highlighter registration that can never fire
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.
This commit is contained in:
@@ -14,10 +14,18 @@ import type { LanguageRegistration } from 'shiki'
|
||||
* when it owns the opening brace. Entering mid-string, keys keep `string.quoted.double.json`
|
||||
* and stay string-colored, which is the entire difference this exists to remove. Hence the
|
||||
* hand-written patterns below, which name that scope directly.
|
||||
* - **A Shiki transformer.** A transformer can re-tokenize the body correctly, but it is a
|
||||
* function, and the API reference's request tabs highlight in the browser off a `shikiOptions`
|
||||
* object passed through RSC — where "Functions cannot be passed directly to Client
|
||||
* Components". A grammar is plain data, so it reaches the client path too.
|
||||
* - **A Shiki transformer.** A transformer re-tokenizes the body correctly, but it is a function,
|
||||
* and `shikiOptions` is forwarded into a client component — "Functions cannot be passed
|
||||
* directly to Client Components" takes down every API reference page. A grammar is plain data,
|
||||
* so it survives that boundary.
|
||||
*
|
||||
* Applies to prose fences only, via `langs` on the MDX pipeline. Not the API reference:
|
||||
* fumadocs-openapi calls `renderCodeBlock` with a hard-coded `"json"` for request and response
|
||||
* samples, so a shell injection can never fire there, and its cURL usage tabs highlight in the
|
||||
* browser off fumadocs' own factory — `ClientCodeBlockProvider` sits in a `"use client"` module
|
||||
* the package does not expose through its `exports` map, so reaching it means importing
|
||||
* `fumadocs-openapi/ui/base` from client code and dragging `remark` and
|
||||
* `@fumari/json-schema-ts` into the browser bundle. That broke the deployment once.
|
||||
*
|
||||
* The opening brace requires a `}`, a quoted key, or end-of-line after it. That is what keeps
|
||||
* `awk '{print $1}'` out, while still matching a body whose brace ends the line — Oniguruma
|
||||
|
||||
Reference in New Issue
Block a user