(code: string, language: string)
| 12 | }) |
| 13 | |
| 14 | export default async function codeToHtml(code: string, language: string) { |
| 15 | const highlighter = await getHighlighter({ |
| 16 | themes: [theme], |
| 17 | langs: [...Object.keys(bundledLanguages)], |
| 18 | }) |
| 19 | |
| 20 | return highlighter.codeToHtml(code, { |
| 21 | lang: language, |
| 22 | theme: 'css-variables', |
| 23 | transformers: [ |
| 24 | { |
| 25 | span(node, line, col) { |
| 26 | node.properties['data-token'] = `token:${line}:${col}` |
| 27 | node.properties['class'] = `${node.properties['class']} text-wrap` |
| 28 | }, |
| 29 | }, |
| 30 | ], |
| 31 | }) |
| 32 | } |
nothing calls this directly
no outgoing calls
no test coverage detected