import { getDocsHighlighter, highlightCodeFile } from '@embedpdf/docs-kit/mdx/highlight'; import { CopyButton } from './copy-button'; export type CodeFile = { filename: string; /** A shiki language id: `tsx`, `vue`, `svelte`, `angular-ts`, `bash`… */ language: string; code: string; }; /** * A dark editor card with one highlighted file, rendered on the server at * build time. The highlighting is the docs' own (`@embedpdf/docs-kit/mdx/highlight`): * same theme, same whitespace rules, and install lines get the release * channel stamped exactly like the docs do. */ export async function CodeWindow({ file, className = '', compact = false, fill = false, }: { file: CodeFile; className?: string; /** Smaller type for the hero's floating card. */ compact?: boolean; /** Fill a fixed-height box and scroll inside it, instead of growing with the code. */ fill?: boolean; }) { const highlighter = await getDocsHighlighter(); const highlighted = highlightCodeFile(highlighter, { ...file }); return (
{file.filename}
        {highlighted.highlightedCode ? (
          
        ) : (
          {highlighted.code}
        )}
      
); }