MCPcopy Create free account
hub / github.com/cosscom/coss / highlight

Function highlight

apps/origin/components/code-block.tsx:9–20  ·  view source on GitHub ↗
(code: string, lang: BundledLanguage)

Source from the content-addressed store, hash-verified

7import { codeToHast } from "shiki/bundle/web";
8
9export async function highlight(code: string, lang: BundledLanguage) {
10 const hast = await codeToHast(code, {
11 lang,
12 theme: "github-dark",
13 });
14
15 return toJsxRuntime(hast, {
16 Fragment,
17 jsx,
18 jsxs,
19 }) as JSX.Element;
20}
21
22type Props = {
23 code: string | null;

Callers 2

loadCodeFunction · 0.90
CodeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected