MCPcopy Create free account
hub / github.com/arctic-cli/interface / Markdown

Function Markdown

packages/ui/src/components/markdown.tsx:10–36  ·  view source on GitHub ↗
(
  props: ComponentProps<"div"> & {
    text: string
    class?: string
    classList?: Record<string, boolean>
  },
)

Source from the content-addressed store, hash-verified

8}
9
10export function Markdown(
11 props: ComponentProps<"div"> & {
12 text: string
13 class?: string
14 classList?: Record<string, boolean>
15 },
16) {
17 const [local, others] = splitProps(props, ["text", "class", "classList"])
18 const marked = useMarked()
19 const [html] = createResource(
20 () => strip(local.text),
21 async (markdown) => {
22 return marked.parse(markdown)
23 },
24 )
25 return (
26 <div
27 data-component="markdown"
28 classList={{
29 ...(local.classList ?? {}),
30 [local.class ?? ""]: !!local.class,
31 }}
32 innerHTML={html()}
33 {...others}
34 />
35 )
36}

Callers

nothing calls this directly

Calls 1

stripFunction · 0.85

Tested by

no test coverage detected