MCPcopy Index your code
hub / github.com/anomalyco/opencode / ContentCode

Function ContentCode

packages/web/src/components/share/content-code.tsx:10–30  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

8 flush?: boolean
9}
10export function ContentCode(props: Props) {
11 const [html] = createResource(
12 () => [props.code, props.lang],
13 async ([code, lang]) => {
14 // TODO: For testing delays
15 // await new Promise((resolve) => setTimeout(resolve, 3000))
16 return (await codeToHtml(code || "", {
17 lang: lang && lang in bundledLanguages ? lang : "text",
18 themes: {
19 light: "github-light",
20 dark: "github-dark",
21 },
22 })) as string
23 },
24 )
25 return (
26 <Suspense>
27 <div innerHTML={html()} class={style.root} data-flush={props.flush === true ? true : undefined} />
28 </Suspense>
29 )
30}

Callers

nothing calls this directly

Calls 1

htmlFunction · 0.85

Tested by

no test coverage detected