Files
zeekay f21b520d17 fix: Correct snippet component reference and fix syntax highlighting
- Update snippet.mdx to reference correct component name (code-snippet-demo)
- Create proper working demo for CodeSnippet component with TypeScript example
- Fix syntax highlighting by updating to Shiki v3 API with bundledLanguages
- Add language validation to prevent unsupported language errors
- Improve error handling with HTML escaping fallback
- Rebuild registry with updated component
2025-11-06 13:45:30 -08:00

10 lines
825 B
JSON

{
"name": "code-snippet-demo",
"files": [
{
"name": "code-snippet-demo.tsx",
"content": "\"use client\"\n\nimport { CodeSnippet } from \"@/registry/default/ui/code-snippet\"\n\nconst exampleCode = `function fibonacci(n: number): number {\n if (n <= 1) return n;\n return fibonacci(n - 1) + fibonacci(n - 2);\n}\n\n// Calculate the 10th Fibonacci number\nconst result = fibonacci(10);\nconsole.log(\\`Fibonacci(10) = \\${result}\\`);`\n\nexport default function CodeSnippetDemo() {\n return (\n <div className=\"w-full space-y-6\">\n <CodeSnippet\n code={exampleCode}\n language=\"typescript\"\n filename=\"fibonacci.ts\"\n showLineNumbers\n showCopyButton\n showLanguageBadge\n />\n </div>\n )\n}\n"
}
],
"type": "components:example"
}