summaryrefslogtreecommitdiff
path: root/why-cmark-and-not-x.md
diff options
context:
space:
mode:
Diffstat (limited to 'why-cmark-and-not-x.md')
-rw-r--r--why-cmark-and-not-x.md86
1 files changed, 86 insertions, 0 deletions
diff --git a/why-cmark-and-not-x.md b/why-cmark-and-not-x.md
new file mode 100644
index 0000000..34e013e
--- /dev/null
+++ b/why-cmark-and-not-x.md
@@ -0,0 +1,86 @@
+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:
+
+ % 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>
+
+
+`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))'
+
+