UNPKG

commonmark

Version:

a strongly specified, highly compatible variant of Markdown

640 lines (488 loc) 33.5 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- saved from url=(0032)http://localhost:8000/index.html --> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta name="generator" content="pandoc"> <title></title> <style type="text/css"> pre.sample {background-color: #ddd;} </style> <script src="./index_files/jquery-2.1.3.min.js"></script> <script src="./index_files/benchmark.js"></script> <script src="./index_files/marked.js"></script> <script src="./index_files/markdown-it.js"></script> <script src="./index_files/commonmark.js"></script> <script src="./index_files/Showdown.js"></script> </head> <body> <h1>Benchmarks</h1> <div id="results"> <h2>block-bq-flat</h2><pre class="sample" id="sample_block-bq-flat">&gt; the simple example of a blockquote &gt; the simple example of a blockquote &gt; the simple example of a blockquote &gt; the simple example of a blockquote ... continuation ... continuation ... continuation ... continuation empty blockquote: &gt; &gt; &gt; &gt; </pre><pre class="results" id="results_block-bq-flat">commonmark.js x 21,447 ops/sec ±1.92% (90 runs sampled) showdown.js x 7,487 ops/sec ±1.88% (94 runs sampled) marked.js x 27,586 ops/sec ±5.48% (81 runs sampled) markdown-it x 16,033 ops/sec ±1.01% (94 runs sampled) </pre><h2>block-bq-nested</h2><pre class="sample" id="sample_block-bq-nested">&gt;&gt;&gt;&gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt; deeply nested blockquote &gt;&gt; deeply nested blockquote &gt; deeply nested blockquote &gt; deeply nested blockquote &gt;&gt; deeply nested blockquote &gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt;&gt;&gt; deeply nested blockquote &gt;&gt;&gt;&gt;&gt;&gt; deeply nested blockquote </pre><pre class="results" id="results_block-bq-nested">commonmark.js x 14,343 ops/sec ±2.08% (96 runs sampled) showdown.js x 1,901 ops/sec ±2.00% (97 runs sampled) marked.js x 12,850 ops/sec ±0.86% (98 runs sampled) markdown-it x 6,790 ops/sec ±1.34% (96 runs sampled) </pre><h2>block-code</h2><pre class="sample" id="sample_block-code"> an example of a code block </pre><pre class="results" id="results_block-code">commonmark.js x 64,060 ops/sec ±0.77% (98 runs sampled) showdown.js x 21,942 ops/sec ±0.85% (98 runs sampled) marked.js x 188,488 ops/sec ±2.20% (89 runs sampled) markdown-it x 251,707 ops/sec ±1.23% (96 runs sampled) </pre><h2>block-fences</h2><pre class="sample" id="sample_block-fences"> ``````````text an example ``` of a fenced ``` code block `````````` </pre><pre class="results" id="results_block-fences">commonmark.js x 34,758 ops/sec ±0.76% (97 runs sampled) showdown.js x 13,005 ops/sec ±0.94% (99 runs sampled) marked.js x 199,835 ops/sec ±0.97% (96 runs sampled) markdown-it x 151,714 ops/sec ±0.98% (95 runs sampled) </pre><h2>block-heading</h2><pre class="sample" id="sample_block-heading"># heading ### heading ##### heading # heading # ### heading ### ##### heading \#\#\#\#\###### ############ not a heading </pre><pre class="results" id="results_block-heading">commonmark.js x 19,113 ops/sec ±1.06% (99 runs sampled) showdown.js x 8,958 ops/sec ±0.92% (97 runs sampled) marked.js x 32,255 ops/sec ±1.00% (97 runs sampled) markdown-it x 28,743 ops/sec ±2.62% (88 runs sampled) </pre><h2>block-hr</h2><pre class="sample" id="sample_block-hr"> * * * * * - - - - - ________ ************************* text </pre><pre class="results" id="results_block-hr">commonmark.js x 29,835 ops/sec ±3.02% (92 runs sampled) showdown.js x 19,546 ops/sec ±0.78% (98 runs sampled) marked.js x 41,463 ops/sec ±1.02% (97 runs sampled) markdown-it x 57,270 ops/sec ±2.92% (87 runs sampled) </pre><h2>block-html</h2><pre class="sample" id="sample_block-html">&lt;div class="this is an html block"&gt; blah blah &lt;/div&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; **test** &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; test &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;![CDATA[ [[[[[[[[[[[... *cdata section - this should not be parsed* ...]]]]]]]]]]] ]]&gt; </pre><pre class="results" id="results_block-html">commonmark.js x 13,414 ops/sec ±0.85% (97 runs sampled) showdown.js x 10,275 ops/sec ±0.69% (99 runs sampled) marked.js x 7,057 ops/sec ±0.85% (99 runs sampled) markdown-it x 17,183 ops/sec ±0.74% (98 runs sampled) </pre><h2>block-lheading</h2><pre class="sample" id="sample_block-lheading">heading --- heading =================================== not a heading ----------------------------------- text </pre><pre class="results" id="results_block-lheading">commonmark.js x 35,072 ops/sec ±0.74% (97 runs sampled) showdown.js x 14,886 ops/sec ±1.59% (97 runs sampled) marked.js x 50,852 ops/sec ±1.20% (96 runs sampled) markdown-it x 31,350 ops/sec ±0.82% (92 runs sampled) </pre><h2>block-list-flat</h2><pre class="sample" id="sample_block-list-flat"> - tidy - bullet - list - loose - bullet - list 0. ordered 1. list 2. example - - - - 1. 2. 3. - an example of a list item with a continuation this part is inside the list this part is just a paragraph 1. test - test 1. test - test 111111111111111111111111111111111111111111. is this a valid bullet? - _________________________ - this - is a long - loose - list - with - some tidy - list - items - in - between - _________________________ </pre><pre class="results" id="results_block-list-flat">commonmark.js x 3,500 ops/sec ±1.00% (98 runs sampled) showdown.js x 1,330 ops/sec ±0.88% (95 runs sampled) marked.js x 4,340 ops/sec ±0.85% (99 runs sampled) markdown-it x 6,270 ops/sec ±0.92% (93 runs sampled) </pre><h2>block-list-nested</h2><pre class="sample" id="sample_block-list-nested"> - this - is - a - deeply - nested - bullet - list 1. this 2. is 3. a 4. deeply 5. nested 6. unordered 7. list - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - - - - - - - - - deeply-nested one-element item </pre><pre class="results" id="results_block-list-nested">commonmark.js x 3,449 ops/sec ±0.78% (97 runs sampled) showdown.js x 647 ops/sec ±1.43% (94 runs sampled) marked.js x 3,527 ops/sec ±0.94% (98 runs sampled) markdown-it x 6,519 ops/sec ±0.91% (98 runs sampled) </pre><h2>block-ref-flat</h2><pre class="sample" id="sample_block-ref-flat">[1] [2] [3] [1] [2] [3] [looooooooooooooooooooooooooooooooooooooooooooooooooong label] [1]: &lt;http://something.example.com/foo/bar&gt; [2]: http://something.example.com/foo/bar 'test' [3]: http://foo/bar [ looooooooooooooooooooooooooooooooooooooooooooooooooong label ]: 111 'test' [[[[[[[[[[[[[[[[[[[[ this should not slow down anything ]]]]]]]]]]]]]]]]]]]]: q (as long as it is not referenced anywhere) [[[[[[[[[[[[[[[[[[[[]: this is not a valid reference </pre><pre class="results" id="results_block-ref-flat">commonmark.js x 4,197 ops/sec ±0.81% (94 runs sampled) showdown.js x 7,098 ops/sec ±0.93% (97 runs sampled) marked.js x 2,570 ops/sec ±0.98% (97 runs sampled) markdown-it x 3,673 ops/sec ±0.95% (99 runs sampled) </pre><h2>block-ref-nested</h2><pre class="sample" id="sample_block-ref-nested">[[[[[[[foo]]]]]]] [[[[[[[foo]]]]]]]: bar [[[[[[foo]]]]]]: bar [[[[[foo]]]]]: bar [[[[foo]]]]: bar [[[foo]]]: bar [[foo]]: bar [foo]: bar [*[*[*[*[foo]*]*]*]*] [*[*[*[*[foo]*]*]*]*]: bar [*[*[*[foo]*]*]*]: bar [*[*[foo]*]*]: bar [*[foo]*]: bar [foo]: bar </pre><pre class="results" id="results_block-ref-nested">commonmark.js x 3,518 ops/sec ±1.13% (94 runs sampled) showdown.js x 8,977 ops/sec ±0.89% (97 runs sampled) marked.js x 3,600 ops/sec ±1.30% (97 runs sampled) markdown-it x 5,921 ops/sec ±1.63% (97 runs sampled) </pre><h2>inline-autolink</h2><pre class="sample" id="sample_inline-autolink">closed (valid) autolinks: &lt;ftp://1.2.3.4:21/path/foo&gt; &lt;http://foo.bar.baz?q=hello&amp;id=22&amp;boolean&gt; &lt;http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink/&gt; &lt;teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com&gt; these are not autolinks: &lt;ftp://1.2.3.4:21/path/foo &lt;http://foo.bar.baz?q=hello&amp;id=22&amp;boolean &lt;http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink &lt;teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com &lt; http://foo.bar.baz?q=hello&amp;id=22&amp;boolean &gt; </pre><pre class="results" id="results_inline-autolink">commonmark.js x 9,141 ops/sec ±1.12% (97 runs sampled) showdown.js x 5,120 ops/sec ±0.81% (99 runs sampled) marked.js x 14,564 ops/sec ±0.97% (97 runs sampled) markdown-it x 8,456 ops/sec ±0.91% (98 runs sampled) </pre><h2>inline-backticks</h2><pre class="sample" id="sample_inline-backticks">`lots`of`backticks` ``i``wonder``how``this``will``be``parsed`` </pre><pre class="results" id="results_inline-backticks">commonmark.js x 40,609 ops/sec ±1.03% (98 runs sampled) showdown.js x 8,077 ops/sec ±0.83% (96 runs sampled) marked.js x 35,378 ops/sec ±0.86% (98 runs sampled) markdown-it x 49,370 ops/sec ±0.94% (97 runs sampled) </pre><h2>inline-em-flat</h2><pre class="sample" id="sample_inline-em-flat">*this* *is* *your* *basic* *boring* *emphasis* _this_ _is_ _your_ _basic_ _boring_ _emphasis_ **this** **is** **your** **basic** **boring** **emphasis** </pre><pre class="results" id="results_inline-em-flat">commonmark.js x 9,303 ops/sec ±1.76% (95 runs sampled) showdown.js x 14,591 ops/sec ±1.13% (97 runs sampled) marked.js x 11,518 ops/sec ±0.84% (99 runs sampled) markdown-it x 15,911 ops/sec ±0.91% (97 runs sampled) </pre><h2>inline-em-nested</h2><pre class="sample" id="sample_inline-em-nested">*this *is *a *bunch* of* nested* emphases* __this __is __a __bunch__ of__ nested__ emphases__ ***this ***is ***a ***bunch*** of*** nested*** emphases*** </pre><pre class="results" id="results_inline-em-nested">commonmark.js x 12,260 ops/sec ±1.04% (98 runs sampled) showdown.js x 14,352 ops/sec ±0.99% (99 runs sampled) marked.js x 14,257 ops/sec ±0.83% (96 runs sampled) markdown-it x 14,922 ops/sec ±3.85% (93 runs sampled) </pre><h2>inline-em-worst</h2><pre class="sample" id="sample_inline-em-worst">*this *is *a *worst *case *for *em *backtracking __this __is __a __worst __case __for __em __backtracking ***this ***is ***a ***worst ***case ***for ***em ***backtracking </pre><pre class="results" id="results_inline-em-worst">commonmark.js x 12,180 ops/sec ±1.70% (96 runs sampled) showdown.js x 13,057 ops/sec ±0.68% (100 runs sampled) marked.js x 14,101 ops/sec ±1.38% (96 runs sampled) markdown-it x 8,949 ops/sec ±2.02% (96 runs sampled) </pre><h2>inline-entity</h2><pre class="sample" id="sample_inline-entity">entities: &amp;nbsp; &amp;amp; &amp;copy; &amp;AElig; &amp;Dcaron; &amp;frac34; &amp;HilbertSpace; &amp;DifferentialD; &amp;ClockwiseContourIntegral; &amp;#35; &amp;#1234; &amp;#992; &amp;#98765432; non-entities: &amp;18900987654321234567890; &amp;1234567890098765432123456789009876543212345678987654; &amp;qwertyuioppoiuytrewqwer; &amp;oiuytrewqwertyuioiuytrewqwertyuioytrewqwertyuiiuytri; </pre><pre class="results" id="results_inline-entity">commonmark.js x 11,800 ops/sec ±0.84% (96 runs sampled) showdown.js x 8,926 ops/sec ±3.94% (87 runs sampled) marked.js x 28,159 ops/sec ±0.95% (94 runs sampled) markdown-it x 16,929 ops/sec ±0.75% (96 runs sampled) </pre><h2>inline-escape</h2><pre class="sample" id="sample_inline-escape"> \t\e\s\t\i\n\g \e\s\c\a\p\e \s\e\q\u\e\n\c\e\s \!\\\"\#\$\%\&amp;\'\(\)\*\+\,\.\/\:\;\&lt;\=\&gt;\? \@ \[ \] \^ \_ \` \{ \| \} \~ \- \' \ \\ \\\ \\\\ \\\\\ \&lt;this\&gt; \&lt;is\&gt; \&lt;not\&gt; \&lt;html\&gt; </pre><pre class="results" id="results_inline-escape">commonmark.js x 9,450 ops/sec ±1.44% (95 runs sampled) showdown.js x 6,331 ops/sec ±0.94% (97 runs sampled) marked.js x 7,087 ops/sec ±0.94% (97 runs sampled) markdown-it x 20,606 ops/sec ±1.08% (97 runs sampled) </pre><h2>inline-html</h2><pre class="sample" id="sample_inline-html">Taking commonmark tests from the spec for benchmarking here: &lt;a&gt;&lt;bab&gt;&lt;c2c&gt; &lt;a/&gt;&lt;b2/&gt; &lt;a /&gt;&lt;b2 data="foo" &gt; &lt;a foo="bar" bam = 'baz &lt;em&gt;"&lt;/em&gt;' _boolean zoop:33=zoop:33 /&gt; &lt;33&gt; &lt;__&gt; &lt;a h*#ref="hi"&gt; &lt;a href="hi'&gt; &lt;a href=hi'&gt; &lt; a&gt;&lt; foo&gt;&lt;bar/ &gt; &lt;a href='bar'title=title&gt; &lt;/a&gt; &lt;/foo &gt; &lt;/a href="foo"&gt; foo &lt;!-- this is a comment - with hyphen --&gt; foo &lt;!-- not a comment -- two hyphens --&gt; foo &lt;?php echo $a; ?&gt; foo &lt;!ELEMENT br EMPTY&gt; foo &lt;![CDATA[&gt;&amp;&lt;]]&gt; &lt;a href="&amp;ouml;"&gt; &lt;a href="\*"&gt; &lt;a href="\""&gt; </pre><pre class="results" id="results_inline-html">commonmark.js x 4,780 ops/sec ±1.36% (97 runs sampled) showdown.js x 2,641 ops/sec ±1.18% (95 runs sampled) marked.js x 7,950 ops/sec ±0.65% (99 runs sampled) markdown-it x 5,581 ops/sec ±1.02% (95 runs sampled) </pre><h2>inline-links-flat</h2><pre class="sample" id="sample_inline-links-flat">Valid links: [this is a link]() [this is a link](&lt;http://something.example.com/foo/bar&gt;) [this is a link](http://something.example.com/foo/bar 'test') ![this is an image]() ![this is an image](&lt;http://something.example.com/foo/bar&gt;) ![this is an image](http://something.example.com/foo/bar 'test') [escape test](&lt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;\&gt;&gt; '\'\'\'\'\'\'\'\'\'\'\'\'\'\'') [escape test \]\]\]\]\]\]\]\]\]\]\]\]\]\]\]\]](\)\)\)\)\)\)\)\)\)\)\)\)\)\)) Invalid links: [this is not a link [this is not a link]( [this is not a link](http://something.example.com/foo/bar 'test' [this is not a link]((((((((((((((((((((((((((((((((((((((((((((((( [this is not a link]((((((((((()))))))))) (((((((((())))))))))) </pre><pre class="results" id="results_inline-links-flat">commonmark.js x 5,255 ops/sec ±1.94% (95 runs sampled) showdown.js x 3,054 ops/sec ±0.80% (98 runs sampled) marked.js x 6,404 ops/sec ±0.81% (98 runs sampled) markdown-it x 5,720 ops/sec ±0.82% (97 runs sampled) </pre><h2>inline-links-nested</h2><pre class="sample" id="sample_inline-links-nested">Valid links: [[[[[[[[](test)](test)](test)](test)](test)](test)](test)] [ [[[[[[[[[[[[[[[[[[ [](test) ]]]]]]]]]]]]]]]]]] ](test) Invalid links: [[[[[[[[[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ ![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![ </pre><pre class="results" id="results_inline-links-nested">commonmark.js x 5,731 ops/sec ±1.13% (98 runs sampled) showdown.js x 5,809 ops/sec ±1.19% (97 runs sampled) marked.js x 2,284 ops/sec ±0.87% (98 runs sampled) markdown-it x 4,681 ops/sec ±0.80% (100 runs sampled) </pre><h2>inline-newlines</h2><pre class="sample" id="sample_inline-newlines"> this\ should\ be\ separated\ by\ newlines this should be separated by newlines too this should not be separated by newlines </pre><pre class="results" id="results_inline-newlines">commonmark.js x 17,941 ops/sec ±0.86% (95 runs sampled) showdown.js x 15,050 ops/sec ±0.77% (98 runs sampled) marked.js x 17,909 ops/sec ±2.52% (93 runs sampled) markdown-it x 23,644 ops/sec ±0.81% (95 runs sampled) </pre><h2>lorem1</h2><pre class="sample" id="sample_lorem1">Lorem ipsum dolor sit amet, __consectetur__ adipiscing elit. Cras imperdiet nec erat ac condimentum. Nulla vel rutrum ligula. Sed hendrerit interdum orci a posuere. Vivamus ut velit aliquet, mollis purus eget, iaculis nisl. Proin posuere malesuada ante. Proin auctor orci eros, ac molestie lorem dictum nec. Vestibulum sit amet erat est. Morbi luctus sed elit ac luctus. Proin blandit, enim vitae egestas posuere, neque elit ultricies dui, vel mattis nibh enim ac lorem. Maecenas molestie nisl sit amet velit dictum lobortis. Aliquam erat volutpat. Vivamus sagittis, diam in [vehicula](https://github.com/markdown-it/markdown-it) lobortis, sapien arcu mattis erat, vel aliquet sem urna et risus. Ut feugiat sapien vitae mi elementum laoreet. Suspendisse potenti. Aliquam erat nisl, aliquam pretium libero aliquet, sagittis eleifend nunc. In hac habitasse platea dictumst. Integer turpis augue, tincidunt dignissim mauris id, rhoncus dapibus purus. Maecenas et enim odio. Nullam massa metus, varius quis vehicula sed, pharetra mollis erat. In quis viverra velit. Vivamus placerat, est nec hendrerit varius, enim dui hendrerit magna, ut pulvinar nibh lorem vel lacus. Mauris a orci iaculis, hendrerit eros sed, gravida leo. In dictum mauris vel augue varius, ac ullamcorper nisl ornare. In eu posuere velit, ac fermentum arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam sed malesuada leo, at interdum elit. Nullam ut tincidunt nunc. [Pellentesque][1] metus lacus, commodo eget justo ut, rutrum varius nunc. Sed non rhoncus risus. Morbi sodales gravida pulvinar. Duis malesuada, odio volutpat elementum vulputate, massa magna scelerisque ante, et accumsan tellus nunc in sem. Donec mattis arcu et velit aliquet, non sagittis justo vestibulum. Suspendisse volutpat felis lectus, nec consequat ipsum mattis id. Donec dapibus vehicula facilisis. In tincidunt mi nisi, nec faucibus tortor euismod nec. Suspendisse ante ligula, aliquet vitae libero eu, vulputate dapibus libero. Sed bibendum, sapien at posuere interdum, libero est sollicitudin magna, ac gravida tellus purus eu ipsum. Proin ut quam arcu. Suspendisse potenti. Donec ante velit, ornare at augue quis, tristique laoreet sem. Etiam in ipsum elit. Nullam cursus dolor sit amet nulla feugiat tristique. Phasellus ac tellus tincidunt, imperdiet purus eget, ullamcorper ipsum. Cras eu tincidunt sem. Nullam sed dapibus magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id venenatis tortor. In consectetur sollicitudin pharetra. Etiam convallis nisi nunc, et aliquam turpis viverra sit amet. Maecenas faucibus sodales tortor. Suspendisse lobortis mi eu leo viverra volutpat. Pellentesque velit ante, vehicula sodales congue ut, elementum a urna. Cras tempor, ipsum eget luctus rhoncus, arcu ligula fermentum urna, vulputate pharetra enim enim non libero. Proin diam quam, elementum in eleifend id, elementum et metus. Cras in justo consequat justo semper ultrices. Sed dignissim lectus a ante mollis, nec vulputate ante molestie. Proin in porta nunc. Etiam pulvinar turpis sed velit porttitor, vel adipiscing velit fringilla. Cras ac tellus vitae purus pharetra tincidunt. Sed cursus aliquet aliquet. Cras eleifend commodo malesuada. In turpis turpis, ullamcorper ut tincidunt a, ullamcorper a nunc. Etiam luctus tellus ac dapibus gravida. Ut nec lacus laoreet neque ullamcorper volutpat. Nunc et leo erat. Aenean mattis ultrices lorem, eget adipiscing dolor ultricies eu. In hac habitasse platea dictumst. Vivamus cursus feugiat sapien quis aliquam. Mauris quam libero, porta vel volutpat ut, blandit a purus. Vivamus vestibulum dui vel tortor molestie, sit amet feugiat sem commodo. Nulla facilisi. Sed molestie arcu eget tellus vestibulum tristique. [1]: https://github.com/markdown-it </pre><pre class="results" id="results_lorem1">commonmark.js x 9,550 ops/sec ±0.99% (95 runs sampled) showdown.js x 2,277 ops/sec ±0.90% (96 runs sampled) marked.js x 6,624 ops/sec ±1.13% (96 runs sampled) markdown-it x 6,616 ops/sec ±1.16% (98 runs sampled) </pre><h2>rawtabs</h2><pre class="sample" id="sample_rawtabs"> this is a test for tab expansion, be careful not to replace them with spaces 1 4444 22 333 333 22 4444 1 tab-indented line space-indented line tab-indented line a lot of spaces in between here a lot of tabs in between here </pre><pre class="results" id="results_rawtabs">commonmark.js x 18,045 ops/sec ±0.87% (99 runs sampled) showdown.js x 6,864 ops/sec ±0.69% (99 runs sampled) marked.js x 21,524 ops/sec ±0.75% (99 runs sampled) markdown-it x 22,730 ops/sec ±0.96% (97 runs sampled) </pre></div> <script> var benchmarks = { "block-bq-flat": "> the simple example of a blockquote \n> the simple example of a blockquote\n> the simple example of a blockquote\n> the simple example of a blockquote\n... continuation\n... continuation\n... continuation\n... continuation\n\nempty blockquote:\n\n>\n>\n>\n>\n\n", "block-bq-nested": ">>>>>> deeply nested blockquote\n>>>>> deeply nested blockquote\n>>>> deeply nested blockquote\n>>> deeply nested blockquote\n>> deeply nested blockquote\n> deeply nested blockquote\n\n> deeply nested blockquote\n>> deeply nested blockquote\n>>> deeply nested blockquote\n>>>> deeply nested blockquote\n>>>>> deeply nested blockquote\n>>>>>> deeply nested blockquote\n", "block-code": "\n an\n example\n\n of\n\n\n\n a code\n block\n\n", "block-fences": "\n``````````text\nan\nexample\n```\nof\n\n\na fenced\n```\ncode\nblock\n``````````\n\n", "block-heading": "# heading\n### heading\n##### heading\n\n# heading #\n### heading ###\n##### heading \\#\\#\\#\\#\\######\n\n############ not a heading\n", "block-hr": "\n * * * * *\n\n - - - - -\n\n ________\n\n\n ************************* text\n\n", "block-html": "<div class=\"this is an html block\">\n\nblah blah\n\n</div>\n\n<table>\n <tr>\n <td>\n **test**\n </td>\n </tr>\n</table>\n\n<table>\n\n <tr>\n\n <td>\n\n test\n\n </td>\n\n </tr>\n\n</table>\n\n<![CDATA[\n [[[[[[[[[[[... *cdata section - this should not be parsed* ...]]]]]]]]]]]\n]]>\n\n", "block-lheading": "heading\n---\n\nheading\n===================================\n\nnot a heading\n----------------------------------- text\n", "block-list-flat": " - tidy\n - bullet\n - list\n\n\n - loose\n\n - bullet\n\n - list\n\n\n 0. ordered\n 1. list\n 2. example\n\n\n -\n -\n -\n -\n\n\n 1.\n 2.\n 3.\n\n\n - an example\nof a list item\n with a continuation\n\n this part is inside the list\n\n this part is just a paragraph \n\n\n 1. test\n - test\n 1. test\n - test\n\n\n111111111111111111111111111111111111111111. is this a valid bullet?\n\n - _________________________\n\n - this\n - is\n\n a\n\n long\n - loose\n - list\n\n - with\n - some\n\n tidy\n\n - list\n - items\n - in\n\n - between\n - _________________________\n", "block-list-nested": "\n - this\n - is\n - a\n - deeply\n - nested\n - bullet\n - list\n \n\n 1. this\n 2. is\n 3. a\n 4. deeply\n 5. nested\n 6. unordered\n 7. list\n\n\n - 1\n - 2\n - 3\n - 4\n - 5\n - 6\n - 7\n - 6\n - 5\n - 4\n - 3\n - 2\n - 1\n\n\n - - - - - - - - - deeply-nested one-element item\n\n", "block-ref-flat": "[1] [2] [3] [1] [2] [3]\n\n[looooooooooooooooooooooooooooooooooooooooooooooooooong label]\n\n [1]: <http://something.example.com/foo/bar>\n [2]: http://something.example.com/foo/bar 'test'\n [3]:\n http://foo/bar\n [ looooooooooooooooooooooooooooooooooooooooooooooooooong label ]:\n 111\n 'test'\n [[[[[[[[[[[[[[[[[[[[ this should not slow down anything ]]]]]]]]]]]]]]]]]]]]: q\n (as long as it is not referenced anywhere)\n\n [[[[[[[[[[[[[[[[[[[[]: this is not a valid reference\n", "block-ref-nested": "[[[[[[[foo]]]]]]]\n\n[[[[[[[foo]]]]]]]: bar\n[[[[[[foo]]]]]]: bar\n[[[[[foo]]]]]: bar\n[[[[foo]]]]: bar\n[[[foo]]]: bar\n[[foo]]: bar\n[foo]: bar\n\n[*[*[*[*[foo]*]*]*]*]\n\n[*[*[*[*[foo]*]*]*]*]: bar\n[*[*[*[foo]*]*]*]: bar\n[*[*[foo]*]*]: bar\n[*[foo]*]: bar\n[foo]: bar\n", "inline-autolink": "closed (valid) autolinks:\n\n <ftp://1.2.3.4:21/path/foo>\n <http://foo.bar.baz?q=hello&id=22&boolean>\n <http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink/>\n <teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com>\n\nthese are not autolinks:\n\n <ftp://1.2.3.4:21/path/foo\n <http://foo.bar.baz?q=hello&id=22&boolean\n <http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink\n <teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com\n < http://foo.bar.baz?q=hello&id=22&boolean >\n", "inline-backticks": "`lots`of`backticks`\n\n``i``wonder``how``this``will``be``parsed``\n", "inline-em-flat": "*this* *is* *your* *basic* *boring* *emphasis*\n\n_this_ _is_ _your_ _basic_ _boring_ _emphasis_\n\n**this** **is** **your** **basic** **boring** **emphasis**\n", "inline-em-nested": "*this *is *a *bunch* of* nested* emphases* \n\n__this __is __a __bunch__ of__ nested__ emphases__ \n\n***this ***is ***a ***bunch*** of*** nested*** emphases*** \n", "inline-em-worst": "*this *is *a *worst *case *for *em *backtracking\n\n__this __is __a __worst __case __for __em __backtracking\n\n***this ***is ***a ***worst ***case ***for ***em ***backtracking\n", "inline-entity": "entities:\n\n&nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral;\n\n&#35; &#1234; &#992; &#98765432;\n\nnon-entities:\n\n&18900987654321234567890; &1234567890098765432123456789009876543212345678987654;\n\n&qwertyuioppoiuytrewqwer; &oiuytrewqwertyuioiuytrewqwertyuioytrewqwertyuiiuytri;\n", "inline-escape": "\n\\t\\e\\s\\t\\i\\n\\g \\e\\s\\c\\a\\p\\e \\s\\e\\q\\u\\e\\n\\c\\e\\s\n\n\\!\\\\\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\n\n\\@ \\[ \\] \\^ \\_ \\` \\{ \\| \\} \\~ \\- \\'\n\n\\\n\\\\\n\\\\\\\n\\\\\\\\\n\\\\\\\\\\\n\n\\<this\\> \\<is\\> \\<not\\> \\<html\\>\n\n", "inline-html": "Taking commonmark tests from the spec for benchmarking here:\n\n<a><bab><c2c>\n\n<a/><b2/>\n\n<a /><b2\ndata=\"foo\" >\n\n<a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 />\n\n<33> <__>\n\n<a h*#ref=\"hi\">\n\n<a href=\"hi'> <a href=hi'>\n\n< a><\nfoo><bar/ >\n\n<a href='bar'title=title>\n\n</a>\n</foo >\n\n</a href=\"foo\">\n\nfoo <!-- this is a\ncomment - with hyphen -->\n\nfoo <!-- not a comment -- two hyphens -->\n\nfoo <?php echo $a; ?>\n\nfoo <!ELEMENT br EMPTY>\n\nfoo <![CDATA[>&<]]>\n\n<a href=\"&ouml;\">\n\n<a href=\"\\*\">\n\n<a href=\"\\\"\">\n", "inline-links-flat": "Valid links:\n\n [this is a link]()\n [this is a link](<http://something.example.com/foo/bar>)\n [this is a link](http://something.example.com/foo/bar 'test')\n ![this is an image]()\n ![this is an image](<http://something.example.com/foo/bar>)\n ![this is an image](http://something.example.com/foo/bar 'test')\n \n [escape test](<\\>\\>\\>\\>\\>\\>\\>\\>\\>\\>\\>\\>\\>\\>> '\\'\\'\\'\\'\\'\\'\\'\\'\\'\\'\\'\\'\\'\\'')\n [escape test \\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]\\]](\\)\\)\\)\\)\\)\\)\\)\\)\\)\\)\\)\\)\\)\\))\n\nInvalid links:\n\n [this is not a link\n\n [this is not a link](\n\n [this is not a link](http://something.example.com/foo/bar 'test'\n \n [this is not a link](((((((((((((((((((((((((((((((((((((((((((((((\n \n [this is not a link]((((((((((()))))))))) (((((((((()))))))))))\n", "inline-links-nested": "Valid links:\n\n[[[[[[[[](test)](test)](test)](test)](test)](test)](test)]\n\n[ [[[[[[[[[[[[[[[[[[ [](test) ]]]]]]]]]]]]]]]]]] ](test)\n\nInvalid links:\n\n[[[[[[[[[\n\n[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [\n\n![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![![\n", "inline-newlines": "\nthis\\\nshould\\\nbe\\\nseparated\\\nby\\\nnewlines\n\nthis \nshould \nbe \nseparated \nby \nnewlines \ntoo\n\nthis\nshould\nnot\nbe\nseparated\nby\nnewlines\n\n", "lorem1": "Lorem ipsum dolor sit amet, __consectetur__ adipiscing elit. Cras imperdiet nec erat ac condimentum. Nulla vel rutrum ligula. Sed hendrerit interdum orci a posuere. Vivamus ut velit aliquet, mollis purus eget, iaculis nisl. Proin posuere malesuada ante. Proin auctor orci eros, ac molestie lorem dictum nec. Vestibulum sit amet erat est. Morbi luctus sed elit ac luctus. Proin blandit, enim vitae egestas posuere, neque elit ultricies dui, vel mattis nibh enim ac lorem. Maecenas molestie nisl sit amet velit dictum lobortis. Aliquam erat volutpat.\n\nVivamus sagittis, diam in [vehicula](https://github.com/markdown-it/markdown-it) lobortis, sapien arcu mattis erat, vel aliquet sem urna et risus. Ut feugiat sapien vitae mi elementum laoreet. Suspendisse potenti. Aliquam erat nisl, aliquam pretium libero aliquet, sagittis eleifend nunc. In hac habitasse platea dictumst. Integer turpis augue, tincidunt dignissim mauris id, rhoncus dapibus purus. Maecenas et enim odio. Nullam massa metus, varius quis vehicula sed, pharetra mollis erat. In quis viverra velit. Vivamus placerat, est nec hendrerit varius, enim dui hendrerit magna, ut pulvinar nibh lorem vel lacus. Mauris a orci iaculis, hendrerit eros sed, gravida leo. In dictum mauris vel augue varius, ac ullamcorper nisl ornare. In eu posuere velit, ac fermentum arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nullam sed malesuada leo, at interdum elit.\n\nNullam ut tincidunt nunc. [Pellentesque][1] metus lacus, commodo eget justo ut, rutrum varius nunc. Sed non rhoncus risus. Morbi sodales gravida pulvinar. Duis malesuada, odio volutpat elementum vulputate, massa magna scelerisque ante, et accumsan tellus nunc in sem. Donec mattis arcu et velit aliquet, non sagittis justo vestibulum. Suspendisse volutpat felis lectus, nec consequat ipsum mattis id. Donec dapibus vehicula facilisis. In tincidunt mi nisi, nec faucibus tortor euismod nec. Suspendisse ante ligula, aliquet vitae libero eu, vulputate dapibus libero. Sed bibendum, sapien at posuere interdum, libero est sollicitudin magna, ac gravida tellus purus eu ipsum. Proin ut quam arcu.\n\nSuspendisse potenti. Donec ante velit, ornare at augue quis, tristique laoreet sem. Etiam in ipsum elit. Nullam cursus dolor sit amet nulla feugiat tristique. Phasellus ac tellus tincidunt, imperdiet purus eget, ullamcorper ipsum. Cras eu tincidunt sem. Nullam sed dapibus magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In id venenatis tortor. In consectetur sollicitudin pharetra. Etiam convallis nisi nunc, et aliquam turpis viverra sit amet. Maecenas faucibus sodales tortor. Suspendisse lobortis mi eu leo viverra volutpat. Pellentesque velit ante, vehicula sodales congue ut, elementum a urna. Cras tempor, ipsum eget luctus rhoncus, arcu ligula fermentum urna, vulputate pharetra enim enim non libero.\n\nProin diam quam, elementum in eleifend id, elementum et metus. Cras in justo consequat justo semper ultrices. Sed dignissim lectus a ante mollis, nec vulputate ante molestie. Proin in porta nunc. Etiam pulvinar turpis sed velit porttitor, vel adipiscing velit fringilla. Cras ac tellus vitae purus pharetra tincidunt. Sed cursus aliquet aliquet. Cras eleifend commodo malesuada. In turpis turpis, ullamcorper ut tincidunt a, ullamcorper a nunc. Etiam luctus tellus ac dapibus gravida. Ut nec lacus laoreet neque ullamcorper volutpat.\n\nNunc et leo erat. Aenean mattis ultrices lorem, eget adipiscing dolor ultricies eu. In hac habitasse platea dictumst. Vivamus cursus feugiat sapien quis aliquam. Mauris quam libero, porta vel volutpat ut, blandit a purus. Vivamus vestibulum dui vel tortor molestie, sit amet feugiat sem commodo. Nulla facilisi. Sed molestie arcu eget tellus vestibulum tristique.\n\n[1]: https://github.com/markdown-it\n", "rawtabs": "\nthis is a test for tab expansion, be careful not to replace them with spaces\n\n1\t4444\n22\t333\n333\t22\n4444\t1\n\n\n\ttab-indented line\n space-indented line\n\ttab-indented line\n\n\na lot of spaces in between here\n\na lot of\t\t\t\t\t\t\t\t\t\t\t\ttabs in between here\n\n", }; var showdown = new Showdown.converter().makeHtml; var markdown_it = markdownit('commonmark'); var parser = new commonmark.Parser(); var renderer = new commonmark.HtmlRenderer(); var runBenchmarks = function() { for (var name in benchmarks) { var suite = new Benchmark.Suite(name); var contents = benchmarks[name]; suite.add('commonmark.js', function() { renderer.render(parser.parse(contents)); }) .add('showdown.js', function() { showdown(contents); }) .add('marked.js', function() { marked(contents); }) .add('markdown-it', function() { markdown_it.render(contents); }) .on('start', function(event) { console.log('Starting ' + name); $("#results").append('<h2>' + name + '</h2>'); $("#results").append('<pre class="sample" id="sample_' + name + '"></pre>'); $("#sample_" + name).text(contents); $("#results").append('<pre class="results" id="results_' + name + '"></pre>'); }) .on('cycle', function(event) { console.log(String(event.target)); $("#results_" + name).append(String(event.target) + '\n'); }) .on('complete', function(event) { $("#results_" + name).show(); }) .run(); } }; $(document).ready(runBenchmarks); </script> </body></html>