MCPcopy Create free account
hub / github.com/coderoad/coderoad-vscode / highlight

Function highlight

web-app/src/components/Markdown/index.tsx:16–27  ·  view source on GitHub ↗
(str, lang)

Source from the content-addressed store, hash-verified

14 html: true,
15 linkify: true,
16 highlight(str, lang) {
17 let hl
18
19 try {
20 hl = Prism.highlight(str, Prism.languages[lang], lang)
21 } catch (error: any) {
22 logger(`Error highlighting markdown: ${error.message}`)
23 hl = md.utils.escapeHtml(str)
24 }
25
26 return `<pre class="language-${lang}"><code class="language-${lang}">${hl}</code></pre>`
27 },
28})
29 // add emoji: https://github.com/markdown-it/markdown-it-emoji
30 .use(markdownEmoji)

Callers

nothing calls this directly

Calls 1

loggerFunction · 0.50

Tested by

no test coverage detected