Use `decode-named-character-reference` for HTML entities?
with #37, markdown-exit decodes entities with entities@9. its decodeHTML pulls in the full HTML5 decode table as a packed trie, which is 30 KiB minified / 13.5 KiB gzip and compresses poorly.
decode-named-character-reference is what micromark and remark use. it ships the same table as a plain object (35.0 / 11.6 KiB in Node), and its browser export decodes through the DOM, so browser bundles carry no table at all (0.2 / 0.2 KiB).
| decoder | KiB minified / gzip |
|---|---|
entities@9 decodeHTML |
30.0 / 13.5 |
decode-named-character-reference, Node |
35.0 / 11.6 |
decode-named-character-reference, browser |
0.2 / 0.2 |
the call sites are parser/inline/rules/entity.ts and common/utils.ts (unescapeAll). the API differs: it takes the name without & and ; and returns false for unknown names, so those two spots would change rather than just the import. the CommonMark fixtures should catch any decoding difference.
would you take a PR for this? happy to send one.
esbuild 0.28, minified ESM, gzip -9.