MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / codeToHtml

Function codeToHtml

src/lib/codeToHtml.ts:14–32  ·  view source on GitHub ↗
(code: string, language: string)

Source from the content-addressed store, hash-verified

12})
13
14export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected