import { CodeBlock } from "@vercel/geistdocs/components/code-block"; import { codeToTokens, type BundledLanguage, type SpecialLanguage } from "shiki"; import { docsShikiTheme } from "@/lib/shiki-theme"; /** Highlight homepage examples using the same theme and code UI as the docs. */ export async function Code({ children, lang = "typescript", filename }: { children: string; lang?: BundledLanguage | SpecialLanguage; filename?: string; }) { const { tokens } = await codeToTokens(children.trim(), { lang, theme: docsShikiTheme }); return ( {tokens.map((line, index) => ( {line.map((token, i) => {token.content})} {index < tokens.length - 1 ? "\n" : ""} ))} ); }