MCPcopy Create free account
hub / github.com/AntiHub-Project/AntiHub / highlightCode

Function highlightCode

components/ai-elements/code-block.tsx:52–73  ·  view source on GitHub ↗
(
  code: string,
  language: BundledLanguage,
  showLineNumbers = false
)

Source from the content-addressed store, hash-verified

50};
51
52export async function highlightCode(
53 code: string,
54 language: BundledLanguage,
55 showLineNumbers = false
56) {
57 const transformers: ShikiTransformer[] = showLineNumbers
58 ? [lineNumberTransformer]
59 : [];
60
61 return await Promise.all([
62 codeToHtml(code, {
63 lang: language,
64 theme: "one-light",
65 transformers,
66 }),
67 codeToHtml(code, {
68 lang: language,
69 theme: "one-dark-pro",
70 transformers,
71 }),
72 ]);
73}
74
75export const CodeBlock = ({
76 code,

Callers 1

CodeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected