({
code,
lang,
theme = "github-dark",
className,
}: SyntaxHighlightProps)
| 136 | } |
| 137 | |
| 138 | export function SyntaxHighlight({ |
| 139 | code, |
| 140 | lang, |
| 141 | theme = "github-dark", |
| 142 | className, |
| 143 | }: SyntaxHighlightProps) { |
| 144 | const html = useHighlightedCode({ code, lang, theme }); |
| 145 | |
| 146 | if (html) { |
| 147 | return ( |
| 148 | <div |
| 149 | className={className} |
| 150 | // shiki wraps output in <pre><code> already |
| 151 | dangerouslySetInnerHTML={{ __html: html }} |
| 152 | /> |
| 153 | ); |
| 154 | } |
| 155 | |
| 156 | return ( |
| 157 | <pre className={className}> |
| 158 | <code>{code}</code> |
| 159 | </pre> |
| 160 | ); |
| 161 | } |
nothing calls this directly
no test coverage detected