the secret is between the regex and the reusable chunker() function, also how regex is used by the lexer with special 1-character symbols representing fully parsed tokens.
it parses to JXML instead of HTML but once you understand how simple it is you can see how it would be easy to adapt without adding extra lines.
that is all 🐱 feel free to assimilate any ideas on your quest for a sub-1k parser. thanks for your time.
Y'all may be able to appreciate the technique behind my parser which is also minimalist ~1.5KB minified.
It doesn't support all the cases (still need to add image, table, blockquote) but it supported enough to make this full set of documentation, lol:
https://mikesmullin.github.io/m-js/
the secret is between the regex and the reusable
chunker()
function, also how regex is used by the lexer with special 1-character symbols representing fully parsed tokens.it parses to JXML instead of HTML but once you understand how simple it is you can see how it would be easy to adapt without adding extra lines.
that is all 🐱 feel free to assimilate any ideas on your quest for a sub-1k parser. thanks for your time.