MCPcopy Create free account
hub / github.com/Hashnode/starter-kit / unescape

Function unescape

packages/utils/renderer/marked.js:1234–1246  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

1232 }
1233
1234 function unescape(html) {
1235 // explicitly match decimal, hex, and named HTML entities
1236 return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function (_, n) {
1237 n = n.toLowerCase();
1238 if (n === 'colon') return ':';
1239 if (n.charAt(0) === '#') {
1240 return n.charAt(1) === 'x'
1241 ? String.fromCharCode(parseInt(n.substring(2), 16))
1242 : String.fromCharCode(+n.substring(1));
1243 }
1244 return '';
1245 });
1246 }
1247
1248 function replace(regex, opt) {
1249 regex = regex.source;

Callers 1

marked.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected