cmark-gfm: Fast, accurate GitHub Flavored Markdown parser and renderer

[ bsd3, library, text ] [ Propose Tags ] [ Report a vulnerability ]

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 (0.29.0.gfm.13) and does not require prior installation of the C library.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
pkgconfig

Use system libcmark-gfm via pkgconfig

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6
Change log changelog
Dependencies base (>=4.5 && <5.0), bytestring (>=0.11.5 && <0.13), ghc-prim (>=0.2), text (>=1.0 && <2.2) [details]
License BSD-3-Clause
Copyright (C) 2015--17 John MacFarlane, (C) 2017--19 Ashe Connor
Author Asherah Connor
Maintainer ashe@kivikakk.ee
Revised Revision 1 made by janus at 2023-10-18T19:53:50Z
Category Text
Home page https://github.com/kivikakk/cmark-gfm-hs
Source repo head: git clone git://github.com/kivikakk/cmark-gfm-hs.git
Uploaded by kivikakk at 2023-08-28T14:20:12Z
Distributions Arch:0.2.5, Debian:0.2.1, Fedora:0.2.6, LTSHaskell:0.2.6, NixOS:0.2.6, Stackage:0.2.6
Reverse Dependencies 4 direct, 169 indirect [details]
Downloads 32631 total (132 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-08-28 [all 1 reports]

Readme for cmark-gfm-0.2.6

[back to package description]

cmark-gfm-hs

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.

  • Memory footprint: Memory footprint is on par with sundown. On one sample, the library uses a fourth the memory that markdown uses, and less than a tenth the memory that pandoc uses.

  • 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-gfm 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 Node tree that can be processed further using Haskell.

A note on stability: There is a good chance the API will change significantly after this early release.