File: why-cmark-and-not-x.md

package info (click to toggle)
cmark 0.29.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,688 kB
  • sloc: ansic: 7,254; python: 893; makefile: 164; cpp: 23; perl: 21; ruby: 11; sh: 7
file content (104 lines) | stat: -rw-r--r-- 1,590 bytes parent folder | download | duplicates (6)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Why use `cmark` and not X?
==========================

`hoedown`
---------

`hoedown` (which derives from `sundown`) is slightly faster
than `cmark` in our benchmarks (0.21s vs. 0.29s).  But both
are much faster than any other available implementations.

`hoedown` boasts of including "protection against all possible
DOS attacks," but there are some chinks in the armor:

    % time python -c 'print(("[" * 50000) + "a" + ("]" * 50000))' | cmark
    ...
    user 0m0.073s
    % time python -c 'print(("[" * 50000) + "a" + ("]" * 50000))' | hoedown
    ...
    0m17.84s

`hoedown` has many parsing bugs.  Here is a selection (as of
v3.0.3):

    % hoedown
    - one
      - two
        1. three
    ^D
    <ul>
    <li>one

    <ul>
    <li>two</li>
    <li>three</li>
    </ul></li>
    </ul>


    % hoedown
    ## hi\###
    ^D
    <h2>hi\</h2>


    % hoedown
    [ΑΓΩ]: /φου

    [αγω]
    ^D
    <p>[αγω]</p>


    % hoedown
    ```
    [foo]: /url
    ```

    [foo]
    ^D
    <p>```</p>

    <p>```</p>

    <p><a href="/url">foo</a></p>


    % hoedown
    [foo](url "ti\*tle")
    ^D
    <p><a href="url" title="ti\*tle">foo</a></p>


    % ./hoedown
    - one
     - two
      - three
       - four
    ^D
    <ul>
    <li>one

    <ul>
    <li>two</li>
    <li>three</li>
    <li>four</li>
    </ul></li>
    </ul>


`discount`
----------

`cmark` is about six times faster.

`kramdown`
----------

`cmark` is about a hundred times faster.

`kramdown` also gets tied in knots by pathological input like

    python -c 'print(("[" * 50000) + "a" + ("]" * 50000))'