MCPcopy
hub / github.com/markedjs/marked / escapeHtmlEntities

Function escapeHtmlEntities

src/helpers.ts:15–27  ·  view source on GitHub ↗
(html: string, encode?: boolean)

Source from the content-addressed store, hash-verified

13const getEscapeReplacement = (ch: string) => escapeReplacements[ch];
14
15export function escapeHtmlEntities(html: string, encode?: boolean) {
16 if (encode) {
17 if (other.escapeTest.test(html)) {
18 return html.replace(other.escapeReplace, getEscapeReplacement);
19 }
20 } else {
21 if (other.escapeTestNoEncode.test(html)) {
22 return html.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
23 }
24 }
25
26 return html;
27}
28
29export function cleanUrl(href: string) {
30 try {

Callers 6

onErrorMethod · 0.90
codeMethod · 0.90
codespanMethod · 0.90
linkMethod · 0.90
imageMethod · 0.90
textMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…