You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Front-code the named entity table to save about 2 KiB gzip? #44
Store the named entity table front-coded and export the decoder.
Motivation
character-entities is 34.9 KiB of the 98.2 KiB minified core bundle. Front-coding the sorted names, like LeftArrow and LeftArrowBar, and delta-coding the values gives the same 2,125 entries in less space.
markdown-exit/core
before
after
change
minified
98.2 KiB
83.6 KiB
-14.6 KiB
gzip
33.92 KiB
31.75 KiB
-2.17 KiB
The test suite passes.
Importing the table takes 6.4 ms instead of 2.3 ms on Node 24. Unpacking it on the first named entity would avoid that for most documents. I haven't tried that yet.
Proposed Solution
Generate the packed table from character-entities at build time, and export decodeNamedEntity. Since comarkdown/comark#549, Comark reads character-entities directly to share one copy with markdown-exit, so it needs the decoder to keep sharing.
Activity