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

Function escape

packages/utils/renderer/marked.js:1225–1232  ·  view source on GitHub ↗

* Helpers

(html, encode)

Source from the content-addressed store, hash-verified

1223 */
1224
1225 function escape(html, encode) {
1226 return html
1227 .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
1228 .replace(/</g, '&lt;')
1229 .replace(/>/g, '&gt;')
1230 .replace(/"/g, '&quot;')
1231 .replace(/'/g, '&#39;');
1232 }
1233
1234 function unescape(html) {
1235 // explicitly match decimal, hex, and named HTML entities

Callers 2

marked.jsFile · 0.85
markedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected