(code: string, lang: BundledLanguage)
| 7 | import { codeToHast } from "shiki/bundle/web"; |
| 8 | |
| 9 | export async function highlight(code: string, lang: BundledLanguage) { |
| 10 | const hast = await codeToHast(code, { |
| 11 | lang, |
| 12 | theme: "github-dark", |
| 13 | }); |
| 14 | |
| 15 | return toJsxRuntime(hast, { |
| 16 | Fragment, |
| 17 | jsx, |
| 18 | jsxs, |
| 19 | }) as JSX.Element; |
| 20 | } |
| 21 | |
| 22 | type Props = { |
| 23 | code: string | null; |