MCPcopy Create free account
hub / github.com/CoderOpen/waimai / escape

Function escape

front/components/marked/lib/marked.js:1276–1283  ·  view source on GitHub ↗

* Helpers

(html, encode)

Source from the content-addressed store, hash-verified

1274 */
1275
1276function escape(html, encode) {
1277 return html
1278 .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
1279 .replace(/</g, '&lt;')
1280 .replace(/>/g, '&gt;')
1281 .replace(/"/g, '&quot;')
1282 .replace(/'/g, '&#39;');
1283}
1284
1285function unescape(html) {
1286 // 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