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
This is really nice. The examples show only conversion to html.
Is there an easy way to get the intermediate output and convert
to PDF through latex, to org-mode, etc., or to change the html
conversion? One use case that is easy with Pandoc is to copy just
the code from markdown into its own source file as a simple form
of literate programming.