cmark (original) (raw)
cmark: Fast, accurate CommonMark (Markdown) parser and renderer
This package provides Haskell bindings forlibcmark, the reference parser for CommonMark, a fully specified variant of Markdown. It includes sources for libcmark (0.30.3) and does not require prior installation of the C library.
Flags
Automatic Flags
Name | Description | Default |
---|---|---|
pkgconfig | Use system libcmark via pkgconfig | Disabled |
Use -f to enable a flag, or -f - to disable that flag. More info
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.2, 0.2.0.1, 0.2.0.2, 0.3, 0.3.0.1, 0.3.1, 0.3.2, 0.3.3, 0.3.3.1, 0.3.4, 0.3.5, 0.4.0.1, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.2.1, 0.5.3, 0.5.3.1, 0.5.4, 0.5.5, 0.5.5.1, 0.5.6, 0.5.6.1, 0.5.6.3, 0.6, 0.6.1 (info) |
---|---|
Change log | changelog |
Dependencies | base (>=4.5 && <5.0), bytestring, ghc-prim (>=0.2), text (>=1.0 && <2.2) [details] |
License | BSD-3-Clause |
Copyright | (C) 2015-17 John MacFarlane |
Author | John MacFarlane |
Maintainer | jgm@berkeley.edu |
Revised | Revision 1 made by JohnMacFarlane at 2023-12-27T00:04:49Z |
Category | Text |
Home page | https://github.com/jgm/cmark-hs |
Source repo | head: git clone git://github.com/jgm/cmark-hs.git |
Uploaded | by JohnMacFarlane at 2023-07-08T17:08:28Z |
Distributions | Debian:0.6, Fedora:0.6.1, FreeBSD:0.4.0.1, LTSHaskell:0.6.1, NixOS:0.6.1, Stackage:0.6.1 |
Reverse Dependencies | 11 direct, 168 indirect [details] |
Downloads | 41699 total (25 in the last 30 days) |
Rating | 2.25 (votes: 2)[estimated by Bayesian average] |
Your Rating | λ λ λ |
Status | Docs available [build log]Last success reported on 2023-07-08 [all 1 reports] |
Readme for cmark-0.6.1
cmark-hs
This package provides Haskell bindings for libcmark, the reference parser for CommonMark, a fully specified variant of Markdown. It includes sources for libcmark 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 thesundown 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 thanmarkdown, 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 markdownuses, 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 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 libcmarkAPI, 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 security: This library does not attempt to sanitize HTML output. We recommend using xss-sanitize to filter the output, or enabling optSafe
to filter out all raw HTML and potentially dangerous URLs.
A note on stability: There is a good chance the API will change significantly after this early release.