This package provides Haskell bindings for libcmark-gfm, the reference parser for GitHub Flavored Markdown, a fully specified variant of Markdown. It includes sources for libcmark-gfm and does not require prior installation of the C library.
cmark provides the following advantages over existing Markdown libraries for Haskell:
Speed: cmark can render a Markdown version of War and Peace in the blink of an eye. Conversion speed is on par with the sundown library, though we were unable to benchmark precisely, because sundown raised a malloc error when compiled into our benchmark suite. Relative to other Haskell Markdown libraries: cmark was 82 times faster than cheapskate, 59 times faster than markdown, 105 times faster than pandoc, and 3 times faster than discount.
Robustness: cmark can handle whatever is thrown at it, without the exponential blowups in parsing time that sometimes afflict other libraries. (The input
bench/full-sample.md, for example, causes both pandoc and markdown to grind to a halt.) libcmark-gfm has been extensively fuzz-tested.
Accuracy: cmark passes the CommonMark spec's suite of over 600 conformance tests.
Standardization: Since there is a spec and a comprehensive suite of tests, we can have a high degree of confidence that any two CommonMark implementations will behave the same. Thus, for example, one could use this library for server-side rendering and commonmark.js for client-side previewing.
Multiple renderers. Output in HTML, groff man, LaTeX, CommonMark, and a custom XML format is supported. And it is easy to write new renderers to support other formats.
Ease of installation: cmark is portable and has minimal dependencies.
cmark does not provide Haskell versions of the whole libcmark-gfm
API, which is built around mutable
cmark_node objects. Instead, it
provides functions for converting CommonMark to HTML (and other
formats), and a function for converting CommonMark to a
tree that can be processed further using Haskell.
A note on security: This library does not attempt to sanitize
HTML output. We recommend using xss-sanitize to filter the output,
optSafe to filter out all raw HTML and potentially
A note on stability: There is a good chance the API will change significantly after this early release.
* Update to cmark-gfm 0.28.0.gfm.6.
cmark-gfm 0.1.2 (09 Aug 2017)
* Update to cmark-gfm 0.28.0.gfm.5.
cmark-gfm 0.1.1 (03 Aug 2017)
* Automatically register plugins.
* Rename alignment values to not clash with `None`, `Left`.
* Fix a potential use-after-free.
cmark-gfm 0.1.0 (03 Aug 2017)
* Update to cmark-gfm (between revisions).
* Add extension support.
cmark 0.5.5.1 (02 Aug 2017)
* Update to cmark 0.28.0.
cmark 0.5.5.1 (20 Mar 2017)
* Update version bound for HUnit.
cmark 0.5.5 (31 Jan 2017)
* Update to cmark 0.27.1.
* Update version bounds for dependencies.
cmark 0.5.4 (18 Nov 2016)
* Update to cmark 0.27.0.
cmark 0.5.3.1 (16 Jul 2016)
* Remove unnecessary typedef that caused problems with the build
(patch from upstream).
cmark 0.5.3 (15 Jul 2016)
* Update to cmark 0.26.0.
* Added appveyor CI.
cmark 0.5.2.1 (22 May 2016)
* New .travis.yml - test with stack, cabal on many versions.
* Increase upper bound of base (Utku Demir).
cmark 0.5.2 (26 Mar 2016)
* Add flag to allow building with an installed libcmark (Jens Petersen).
* Updated to libcmark 0.25.2.
cmark 0.5.1 (21 Jan 2016)
* Updated to libcmark 0.24.1.
cmark 0.5 (29 Dec 2015)
* Updated to libcmark 0.23.0.
* API changes:
+ Added `OnEnter` and `OnExit` types.
+ In `NodeType`, `HRULE` is now `THEMATIC_BREAK`,
`HTML` is `HTML_BLOCK`, `INLINE_HTML` is
`HTML_INLINE`, `HEADER` is `HEADING`. New
constructors: `CUSTOM_INLINE`, `CUSTOM_BLOCK`.
cmark 0.4.1 (23 Aug 2015)
* Updated to libcmark 0.22.0.
* Bumped version bounds for HUnit.
cmark 0.4.0.1 (14 Jul 2015)
* API changes:
+ Added `commonmarkToLaTeX`, `nodeToLaTeX`, `optSafe`.
+ Changed type of `commonmarkToMan` and `nodeToMan`,
adding `Maybe Int` param for width.
+ Changed type of `nodeToCommonMark`, changing the `Int` width
parameter to a `Maybe Int`.
* Updated to cmark 0.21 sources.
cmark 0.3.4 (08 Jun 2015)
* Updated to libcmark 0.20.0.
cmark 0.3.3.1 (28 May 2015)
* Changed name Bench.hs -> bench-cmark.hs.
* Benchmark: don't benchmark pandoc (circular dependency).
cmark 0.3.3 (26 May 2015)
* Added `nodeToHtml`, `nodeToMan`, `nodeToXml`.
* Added version bounds for text (Albert Krewinkel).
cmark 0.3.2 (28 Apr 2015)
* Updated libcmark C sources to 0.19.0.
* Fixes to avoid warning for earlier ghc versions.
* Refactored, removing the `io` convenience function.
* Removed unnecessary `unsafePerformIO` on `fromtext`.
* `fromtext`: use `ByteString.useAsCString` + explicit `encodeUtf8`.
cmark 0.3.1 (29 Mar 2015)
* Added nodeToCommonmark.
* Removed mtl from build-depends.
* Updated source info in README, cabal.
* Updated C sources.
* Put all the C functions in the IO monad, and ensure
that memory allocated by the C library is freed
at the right time.
* Added a rudimentary test suite.
* Properly free c-allocated resources.
* Removed bindings to nonexistent setters for source pos