Skip to content

Latest commit

 

History

History
104 lines (73 loc) · 1.55 KB

why-cmark-and-not-x.md

File metadata and controls

104 lines (73 loc) · 1.55 KB

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))'