(code: string, language = "tsx")
| 51 | ] as ShikiTransformer[]; |
| 52 | |
| 53 | export async function highlightCode(code: string, language = "tsx") { |
| 54 | const html = await codeToHtml(code, { |
| 55 | lang: language, |
| 56 | themes: { |
| 57 | dark: "github-dark", |
| 58 | light: "github-light", |
| 59 | }, |
| 60 | transformers: [ |
| 61 | { |
| 62 | pre(node) { |
| 63 | node.properties.class = |
| 64 | "no-scrollbar min-w-0 overflow-x-auto px-4 py-3.5 outline-none has-[[data-highlighted-line]]:px-0 has-[[data-line-numbers]]:px-0 has-[[data-slot=tabs]]:p-0 !bg-transparent"; |
| 65 | }, |
| 66 | code(node) { |
| 67 | node.properties["data-line-numbers"] = ""; |
| 68 | }, |
| 69 | line(node) { |
| 70 | node.properties["data-line"] = ""; |
| 71 | }, |
| 72 | }, |
| 73 | ], |
| 74 | }); |
| 75 | |
| 76 | return html; |
| 77 | } |
nothing calls this directly
no outgoing calls
no test coverage detected