MCPcopy
hub / github.com/marktext/marktext / escapeHTML

Function escapeHTML

packages/muya/src/utils/index.ts:138–150  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

136}
137
138export function escapeHTML(str: string) {
139 return str.replace(
140 /[&<>'"]/g,
141 tag =>
142 ({
143 '&': '&amp;',
144 '<': '&lt;',
145 '>': '&gt;',
146 '\'': '&#39;',
147 '"': '&quot;',
148 }[tag] || tag),
149 );
150}
151
152export function unescapeHTML(str: string) {
153 return str.replace(

Callers 6

escapeHTML.spec.tsFile · 0.90
updateMethod · 0.90
escapeLangInputInnerHtmlFunction · 0.90
getCssForOptionsFunction · 0.90
escapeInBlockHtmlFunction · 0.70
sanitizeFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected