MCPcopy
hub / github.com/wandb/openui / fixHTML

Function fixHTML

frontend/src/lib/markdown.ts:16–37  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

14}
15
16export function fixHTML(html: string) {
17 // Replace any gray styles with zinc, fix placeholder images
18 // TODO: this is kinda LAME
19 let fixed = html.replaceAll('-gray-', '-zinc-')
20 // Use placehold.co for images
21 fixed = fixed.replaceAll('via.placeholder.com', 'placehold.co')
22 fixed = fixed.replaceAll('via.placeholder.co', 'placehold.co')
23 fixed = fixed.replaceAll('placehold.it', 'placehold.co')
24 // Point to our own backend for mp3's / wav files
25 fixed = fixed.replaceAll(
26 /"[^"]*\.(mp3|wav)|'[^']*\.(mp3|wav)'/g,
27 `"${document.location.origin}/openui/funky.mp3"`
28 )
29 // Point svg's to our own backend
30 fixed = fixed.replaceAll(
31 /"[^"?]+\/([^/]+)\.svg(["?])/g,
32 `"${document.location.origin}/openui/$1.svg$2`
33 )
34 // Remove any comments in the HTML
35 fixed = fixed.replaceAll(/<!--[\S\s]*?-->/g, '')
36 return fixed
37}
38
39export function parseMarkdown(
40 markdown: string,

Callers 1

parseMarkdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected