commonmark-d: A fast CommonMark and Github Flavoured Markdown parser, translation of MD4C

LocoDelPueblo fdp-dyna-hum at nowhere.mx
Thu Oct 3 08:19:12 UTC 2019


On Monday, 30 September 2019 at 23:06:42 UTC, Guillaume Piolat 
wrote:
> Hello,
>
> commonmark-d is a D translation of MD4C, a fast SAX-like 
> Markdown parser.
> MD4C achieves remarkable parsing speed through the lack of AST 
> and careful memory usage.
>
> The route of translation was choosen because parsing Markdown 
> is much more involved that first thought. The D translation 
> largely preserve the speed benefits of M4DC.
>
>
> Usage:
>
>     // Parse CommonMark, generate HTML
>     import commonmarkd;
>     string html = convertMarkdownToHTML(markdown);
>
> Key Performance Numbers:
>     - commonmark-d compiles 3x faster than dmarkdown and 40x 
> faster than hunt-markdown.
>     - commonmark-d parses Markdown 2x faster than dmarkdown and 
> 15x faster than hunt-markdown (see GitHub for benchmark details)
>
> I haven't measured memory usage of either compile time or run 
> time, but I feel like it's also better.
>
> Available now on DUB: 
> http://code.dlang.org/packages/commonmark-d
> GitHub page: https://github.com/p0nce/commonmark-d

d-markdown was actually extracted from vibe-d a a few years ago, 
mostly for a software called "harbored-mod", to add support for 
markdown in DDOC comments, so vibe-d MD module should still be in 
the same magnitude of "sub-optimal-ity".

For conversions from MD to HTML, in a static context (i.e not a 
server), I'd just use Pandoc. markdown-d had some bugs. Maybe 
fixed in the newest vibe-d since the fork you compare to was 
basically dead-born.



More information about the Digitalmars-d-announce mailing list