(match, name)
| 76 | const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i |
| 77 | |
| 78 | function replaceEntityPattern (match, name) { |
| 79 | if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) { |
| 80 | const code = name[1].toLowerCase() === 'x' |
| 81 | ? parseInt(name.slice(2), 16) |
| 82 | : parseInt(name.slice(1), 10) |
| 83 | |
| 84 | if (isValidEntityCode(code)) { |
| 85 | return fromCodePoint(code) |
| 86 | } |
| 87 | |
| 88 | return match |
| 89 | } |
| 90 | |
| 91 | const decoded = decodeHTML(match) |
| 92 | if (decoded !== match) { |
| 93 | return decoded |
| 94 | } |
| 95 | |
| 96 | return match |
| 97 | } |
| 98 | |
| 99 | function unescapeMd (str) { |
| 100 | if (str.indexOf('\\') < 0) { return str } |
no test coverage detected
searching dependent graphs…