better-parse icon indicating copy to clipboard operation
better-parse copied to clipboard

Parsing Markdown

Open rshah opened this issue 7 years ago • 4 comments

is it possible to use this library to parse Markdown?

rshah avatar Oct 27 '17 12:10 rshah

It should be possible to build a Markdown parser using this library (as it is possible to parse json – I’ve successfully built a sample toy Json parser using better-parse).

But for any production use-case I’d rather go for a dedicated Markdown parser library instead of crafting my own using parser combinators. Just as I use Jackson and its kotlin modules in work, instead of my example linked above.

Not sure what are good libraries for Markdown on JVM (as I never neeeded to parse it), but I’d guess something klike intellij-markdown would be a good choice.

silmeth avatar Oct 27 '17 13:10 silmeth

@rshah Defining a Markdown grammar does not seem to be a practical way of parsing Markdown, see http://roopc.net/posts/2014/markdown-cfg/ I think I can try and come up with a demo parser if I have any success.

h0tk3y avatar Oct 29 '17 14:10 h0tk3y

@silmeth Can I reference your Json parser in the examples section? It would also be kind of you to update it to the 0.3.1 release.

h0tk3y avatar Oct 29 '17 14:10 h0tk3y

@h0tk3y Sure. I wrote it to familiarize with your library and decided to put it on Github as a reference for anyone who similarly wants to see how such a grammar might be written, so I’d be really flattered if the original library referenced my toy example. Thanks. :)

I’ll look into the new release today. Not sure if I bump up the version immediately (are there any big API changes? new features that a simplish json parser should use?), though. Also, if you’d like to do it yourself, I don’t mind accepting a PR. :)

silmeth avatar Oct 29 '17 15:10 silmeth