Markdown to HTML with Java/Scala

I am aware of following projects (mostly from http://www.w3.org/community/markdown/wiki/MarkdownImplementations):

implemented in Java:

  • txtmark http://github.com/rjeschke/txtmark (claims to be fastest MD processor running on the JVM)
  • Markdown4j http://code.google.com/p/markdown4j (fork of txtmark, advantages? more active dev?)
  • MarkdownPapers http://markdown.tautua.org/ (based on JavaCC parser)
  • pegdown http://github.com/sirthias/pegdown
  • MarkdownJ http://code.google.com/p/markdownj (abandoned?)

implemented in Scala:

  • Laika https://github.com/planet42
  • Actuarius http://henkelmann.eu/projects/actuarius/ (acc. to author not fully standards compliant)
  • Knockoff http://tristanhunt.com/projects/knockoff (only subset of MD?)
  • ScalaMD https://github.com/chirino/scalamd

Q: What are the respective performance characteristics, pitfalls, quirks? Which ones support the Github extensions? Which one would you recommend for a Play! / Scala application?


Solution 1:

The fantastic microbenchmark tool created by MarkdownPapers' author compares the performance for the following implementations:

  • MarkdownPapers
  • PegDown
  • Knockoff
  • MarkdownJ
  • TxtMark

TxtMark far exceeds the performance of the other tools, as shown in the following graph:

Performance comparisons of markdown implementations

PegDown, which supports many GitHub extensions and others, is far more fully featured. Custom plugins or extensions are also possible.

My use case involved processing markdown from an administrative screen where performance was less impactful than a rich feature set, which meant PegDown won over TxtMark.