1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>haskell@gentoo.org</email>
<name>Gentoo Haskell</name>
</maintainer>
<use>
<flag name="system-cmark">use <pkg>app-text/cmark</pkg> instead of bundled copy</flag>
</use>
<longdescription>
This package provides Haskell bindings for
<https://github.com/jgm/cmark libcmark>, the reference
parser for <http://commonmark.org CommonMark>, a fully
specified variant of Markdown. It includes sources for
libcmark (0.19.0) and does not require prior installation of the
C library.
cmark provides the following advantages over existing
Markdown libraries for Haskell:
- Speed: Conversion speed is on par with the
<https://hackage.haskell.org/package/sundown sundown>
library. We were unable to measure precisely
against
<https://hackage.haskell.org/package/sundown sundown>,
which raised a malloc error when compiled into our
benchmark suite. Relative to other implementations:
cmark was 82 times faster than
<https://hackage.haskell.org/package/cheapskate cheapskate>,
59 times faster than
<https://hackage.haskell.org/package/markdown markdown>,
105 times faster than
<https://hackage.haskell.org/package/pandoc pandoc>,
and 2.8 times faster than
<https://hackage.haskell.org/package/discount discount>.
- Memory footprint: Memory footprint is on par with
<https://hackage.haskell.org/package/sundown sundown>.
On one sample, the library uses a fourth the memory that
<https://hackage.haskell.org/package/markdown markdown>
uses, and less than a tenth the memory that
<https://hackage.haskell.org/package/pandoc pandoc>
uses.
- Robustness: cmark can handle whatever is thrown
at it, without the exponential blowups in parsing
time one can sometimes get with other libraries.
(The input @bench\/full-sample.md@, for example,
causes both
<https://hackage.haskell.org/package/pandoc pandoc>
and
<https://hackage.haskell.org/package/markdown markdown>
to grind to a halt.)
- Accuracy: cmark passes the CommonMark spec\'s
suite of over 500 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
<https://github.com/jgm/commonmark.js commonmark.js>
for client-side previewing.
- Ease of installation: cmark is portable and has
minimal dependencies.
cmark does not provide Haskell versions of the whole
<https://github.com/jgm/cmark libcmark> 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 security: This library does not attempt
to sanitize HTML output. We recommend using
<https://hackage.haskell.org/package/xss-sanitize xss-sanitize>
to filter the output.
A note on stability: There is a good chance the API
will change significantly after this early release.
</longdescription>
<upstream>
<remote-id type="github">jgm/commonmark-hs</remote-id>
</upstream>
</pkgmetadata>
|