rjeschke / txtmark

Yet another markdown processor for the JVM
Apache License 2.0
449 stars 100 forks source link

Txtmark - Java markdown processor

Copyright (C) 2011-2015 René Jeschke rene_jeschke@yahoo.de
See LICENSE.txt for licensing information.


Txtmark is yet another markdown processor for the JVM.

For an in-depth explanation of markdown have a look at the original Markdown Syntax.


Maven repository

Txtmark is available on maven central.


Txtmark extensions

To enable Txtmark's extended markdown parsing you can use the $PROFILE$ mechanism:

[$PROFILE$]: extended

This seemed to me as the easiest and safest way to enable different behaviours. Just put this line into your Txtmark file like you would use reference links.

Behavior changes when using [$PROFILE$]: extended


Markdown conformity

Txtmark passes all tests inside MarkdownTest_1.0_2007-05-09 except of two:

  1. Images.text

    Fails because Txtmark doesn't produce empty 'title' image attributes.
    (IMHO: Images ... OK)

  2. Literal quotes in titles.text

    What the frell ... this test will continue to FAIL.
    Sorry, but using unescaped " in a title which should be surrounded by " is unacceptable for me ;)

    Change:

    Foo [bar](/url/ "Title with "quotes" inside").

    to:

    Foo [bar](/url/ "Title with \"quotes\" inside").

    and Txtmark will produce the correct result.
    (IMHO: Literal quotes in titles ... OK)


Where Txtmark is not like Markdown


Performance comparison of markdown processors for the JVM

Remarks: These benchmarks are too old to be of any value. I leave them here as a reference, though.

Based on this benchmark suite.

Excerpt from the original post concerning this benchmark suite:

Most of these tests are of course unrealistic: Who would write a text where each word is a link? Yet they serve an important use: It makes it possible for the developer to pinpoint the parts of the parser where there is most room for improvement. Also, it explains why certain texts might render much faster in one Processor than in another.

Benchmark system:

TestActuariusPegDownKnockoffTxtmark
1st Run (ms)2nd Run (ms)1st Run (ms)2nd Run (ms)1st Run (ms)2nd Run (ms)1st Run (ms)2nd Run (ms)
Plain Paragraphs11275771273103774040015764
Every Word Emphasized156210011523151313982132215446
Every Word Strong112599711151114954396474441
Every Word Inline Code38227710581052911690745139
Every Word a Fast Link225716005375313980341010955
Every Word Consisting of Special XML Chars4045427029853044312377778775
Every Word wrapped in manual HTML tags33342919901896386337367362
Every Line with a manual line break51058814451440152711305656
Every word with a full link4522461045996188418198655
Every word with a full image26815011401132198519083836
Every word with a reference link98479082189561871912113611541615251380
Every block a quote445206131213014784575045
Every block a codeblock70873733761611756022
Every block a list920912172017256226515555
All tests together32812885518451961013010460206196
Benchmarked versions:

Actuarius version: 0.2
PegDown version: 0.8.5.4
Knockoff version: 0.7.3-15


Mentioned/related projects

Markdown is Copyright (C) 2004 by John Gruber
SmartyPants is Copyright (C) 2003 by John Gruber
Actuarius is Copyright (C) 2010 by Christoph Henkelmann
Knockoff is Copyright (C) 2009-2011 by Tristan Juricek
PegDown is Copyright (C) 2010 by Mathias Doenitz
PHP Markdown & Extra is Copyright (C) 2009 Michel Fortin


Project link: https://github.com/rjeschke/txtmark