A comparative evalution of open source CLI Markdown processors: discount markdown, hoedown, multimarkdown and pandoc.
View the markdown test page at md_evaluation/md_evaluation.md.
Objectives • Process • Observations • Resources
Objectives ▴
- Markdown Syntax. Find, to the extent possible, a common set of markdown syntax including certain extensions.
- CLI Settings. Find settings which produce the most similar markdown output.
- Extension Support. Evaluate extension support for footnotes, piped tables, fenced code, and LaTeX math.
Process ▴
-
Install 'multimarkdown' (which installs as
markdown), 'hoedown', and 'pandoc' as command line tools.- Uninstall 'multimarkdown' (
brew uninstall multimarkdown) and install 'discount' (which installs asmarkdown) to run tests fordiscount.
- Uninstall 'multimarkdown' (
-
Review/Edit source markdown file "md_evaluation.md".
-
Review "test.sh". Edit options as needed. Run
./test.sh. -
Compare output. The
aandbversions allow comparison what output changed for some settings change for the same CLI tool. Thetxtandhtmlallows for comparison of raw output and how the output renders in a browser.
Note: Discount and MultiMarkdown have install conflicting execution binaries named
markdown. Thus, Discountmarkdownand MultiMarkdownmarkdownare mutually exclusivebrewinstalls. However, Discountmarkdowncan be manually installed somewhere not on$PATHand scripted with/FULL/PATH/TO/markdown.
Observations ▴
The source document md_evaluation.md evolved and evolves to contain details on common syntax and notes on various markdown feature.
Some of the major findings are noted here below.
LaTeX demarkation syntax
$, $$ |
\\(, \\[ |
\(, \[ |
|
|---|---|---|---|
| raw html | ✓ | ||
discount markdown |
✓ | ||
hoedown |
✓ | ✓ | |
multimarkdown |
✓ | ✓ | |
pandoc |
✓ | ✓ | ✓ |
Note: Use of \(, \[ single escape syntax disallows escaping ( and [ for other purposes. hoedown does not have expressly enable/disbale control over dollar sign $ vs. double backslash \\ syntax. pandoc can expressly enable/disable each of the three syntax.
discount markdown
- html fenced code. discount
markdownfenced html with ∼∼∼ html does not generate a useable code block. Angle brackets are not converted to html entities. The enclosing<pre><code>tags are not produced. Workaround Options: (1) fence the html with ∼∼∼ markup or (2) write an html codeblock as raw html in the markdown file.
hoedown
- C Library. MacDown uses
hoedownC library when rendering markdown. - LaTeX guessing.
--mathoption alone can produce incorrect and unexpected output. The combination of--mathand--math-explicitdid produce predictable, reliable results in these tests.
multimarkdown
- C Library
pandoc
- Options. Pandoc has the largest set of enable/disable options. see PandocMarkdownOptions.md
<pre><code>Pandoc generates<pre class="markdown"><code>instead of<pre><code class="language-markdown">.
Resources ▴
- DaringFireball:
markdown⇗ Implementation:Perlv1.0.1 2004.12.17 - Discount
markdown⇗, github ⇗, Implementation:C - GitHub/hoedown:
hoedown⇗ Implementation:Cv3.0.7 2015.12.03 - Markingbird Swift port of MarkdownSharp. No longer actively maintained.
- Pandoc
- Pandoc User’s Guide ⇗
- GitHub: pandoc ⇗ Implementation:
Haskell
- Perfect-Markdown Swift wrapper which directly builds on
libupskirtwhich was forked fromsundown.
CommonMark
Note: CommonMark Spec ⇗ does not mention any support for LaTeX math.
- CommonMark: home ⇗, github ⇗ 0.28.3 2017.10, brew:
cmark|commonmark - Github/github: cmark ⇗ GitHub Flavored Markdown, extended CommonMark , brew:
cmark-cfmv0.28.3.gfm.20- GitHub Flavored Markdown Spec Adds tables, task lists and autolinks. Does not add LaTeX math.
- brew conflict:
cmark|commonmarkandcmark-cfm, both installcmark.h - Github/iwasrobbed: Down ⇗ Swift wrapper for reference
cmarkC. does not use Swift Package Manager. - Github/Pyroh: SwiftMark ⇗ Swift framework which wraps
libcmark. beta 2016.01.26. - Github/calebkleveter: SwiftMark ⇗, guide ⇗, site ⇗ pure Swift. Early development. Roadmap to support GFM (GitHub Flavored Markdown) features.
MultiMarkdown
- MultiMarkdown
markdown - GitHub/fletcher: MultiMarkdown-5
- GitHub/fletcher: MultiMarkdown-6 Implementation:
C - Homebrew installs
multimarkdownwith binarymarkdown.- brew conflict:
discount,markdownandmultimarkdowninstallmarkdownbinaries. - brew conflict: mtools (MSDOS file manipulation) … both install
mmdbinaries.
- brew conflict: