Files
shadcn-ui/apps/www/lib/highlight-code.ts
shadcn 8f0c26f22a feat(www): code for blocks (#5756)
* feat: update blocks

* fix: scrollbars

* fix: code viewer

* test(shadcn): fix
2024-11-07 17:09:41 +04:00

18 lines
329 B
TypeScript

import { codeToHtml } from "shiki"
export async function highlightCode(code: string) {
const html = await codeToHtml(code, {
lang: "jsx",
theme: "github-dark-default",
transformers: [
{
code(node) {
node.properties["data-line-numbers"] = ""
},
},
],
})
return html
}