diff --git a/apps/docs/app/(home)/page.client.tsx b/apps/docs/app/(home)/page.client.tsx index 0bf3da35c..f5b2af59e 100644 --- a/apps/docs/app/(home)/page.client.tsx +++ b/apps/docs/app/(home)/page.client.tsx @@ -88,7 +88,7 @@ export function Rain( export function Previews(): JSX.Element { return (
diff --git a/apps/docs/app/style.css b/apps/docs/app/global.css similarity index 100% rename from apps/docs/app/style.css rename to apps/docs/app/global.css diff --git a/apps/docs/app/layout.tsx b/apps/docs/app/layout.tsx index 76b5e2dc8..9d55855a8 100644 --- a/apps/docs/app/layout.tsx +++ b/apps/docs/app/layout.tsx @@ -1,4 +1,4 @@ -import './style.css'; +import './global.css'; import 'fumadocs-ui/twoslash.css'; import { Star } from 'lucide-react'; import type { Viewport } from 'next'; diff --git a/apps/docs/components/code-block.tsx b/apps/docs/components/code-block.tsx index 1b257a050..aa385b425 100644 --- a/apps/docs/components/code-block.tsx +++ b/apps/docs/components/code-block.tsx @@ -20,43 +20,35 @@ export function CodeBlock({ wrapper, ...props }: CodeBlockProps): JSX.Element { - const tokens = useMemo( + const html = useMemo( () => - highlighter.codeToTokensWithThemes(code, { + highlighter.codeToHtml(code, { lang, + defaultColor: false, themes: { light: 'github-light', dark: 'github-dark', }, + transformers: [ + { + name: 'remove-pre', + root: (root) => { + if (root.children[0].type !== 'element') return; + + return { + type: 'root', + children: root.children[0].children, + }; + }, + }, + ], }), [code, lang], ); return (
- {tokens.map((token, i) => (
- // eslint-disable-next-line react/no-array-index-key -- Should not re-render
-
- {token.map((s, j) => (
- [
- `--shiki-${k}`,
- v.color,
- ]),
- )}
- >
- {s.content}
-
- ))}
-
- ))}
-
- Scroll down to see the button
+
- {icon ??