developit / developit/snarkdown

Sharing Inspiration

Open
#66 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.4k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Y'all may be able to appreciate the technique behind [my parser](https://github.com/mikesmullin/m-js/blob/1d884d21d8b8cdf0da78b1907242d3f8d4bbf05a/src/extras/markdown-jxml.js#L8) 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()`](https://github.com/mikesmullin/m-js/blob/1d884d21d8b8cdf0da78b1907242d3f8d4bbf05a/src/utils.js#L165) 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.