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

Function Markdown

web-app/src/components/Markdown/index.tsx:62–78  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

60}
61
62const Markdown = (props: Props) => {
63 let html: string
64 // TODO: set md to minimal rule set if specified
65 try {
66 html = md.render(props.children)
67 } catch (error) {
68 const message = `Failed to parse markdown for ${props.children}`
69 // TODO: onError(new Error(message))
70 logger(`Error: ${message}`)
71 html = `<div style='background-color: #FFB81A; padding: 0.5rem;'>
72 <strong style='padding-bottom: 0.5rem;'>ERROR: Failed to parse markdown</strong>
73 <p>${props.children}</p>
74 </div>`
75 }
76 // TODO sanitize markdown or HTML
77 return <span className="coderoad-markdown" dangerouslySetInnerHTML={{ __html: html }} />
78}
79
80export default Markdown

Callers

nothing calls this directly

Calls 2

renderMethod · 0.80
loggerFunction · 0.50

Tested by

no test coverage detected