MCPcopy Index your code
hub / github.com/simstudioai/sim / escapeHtml

Function escapeHtml

packages/emcn/src/components/code/code.tsx:90–97  ·  view source on GitHub ↗

* Escapes HTML special characters so raw code can be safely injected via * `dangerouslySetInnerHTML` as the plaintext fallback before Prism loads (and * for unknown languages). Matches Prism's own escaping for visual parity. * * @param text - The raw code text to escape * @returns The HTML-esca

(text: string)

Source from the content-addressed store, hash-verified

88 * @returns The HTML-escaped text
89 */
90function escapeHtml(text: string): string {
91 return text
92 .replace(/&/g, '&')
93 .replace(/</g, '&lt;')
94 .replace(/>/g, '&gt;')
95 .replace(/"/g, '&quot;')
96 .replace(/'/g, '&#39;')
97}
98
99/**
100 * Highlights a single line of code, falling back to escaped plaintext when Prism

Callers 1

highlightOrEscapeFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected