mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
- 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
10 lines
825 B
JSON
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"
|
|
} |