Commonmark-java: First release of Java impl (with autolinking, tables, strikethrough)

I released the first version of a pure Java implementation of CommonMark:

It started out as a line-for-line port of commonmark.js (thanks @jgm and others!), but has become its own thing over time. I also upstreamed some improvements to commonmark.js in the process. It currently implements version 0.21 of the spec.

It comes with the following extensions, but they are optional and are contained in different artifacts:

  • autolinking of plain links without <>

    • Implemented as a post-processor of text nodes
    • Is smart about parens in URLs, see autolink-java for some examples
  • GFM tables (ASCII art tables using pipes)

    • Implemented as a custom block parser. What’s interesting is that it implements and uses the same API as the block parsers in core.
  • GFM strikethrough using ~~

    • Implemented as a custom delimiter, using the same API as the delimiter logic for _ and *

I haven’t benchmarked it against cmark yet, but it easily beats pegdown by a factor of 10 to 20 (depending on input size).

Comments appreciated :slight_smile:

2 Likes