diff --git a/README.md b/README.md index dfc94252..0878689f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # marked -A full-featured markdown parser and compiler implemented in ~430 lines of JS. +A full-featured markdown parser and compiler. Built for speed. ## Benchmarks +node v0.4.x + ``` bash $ node test --bench marked completed in 12071ms. @@ -13,20 +15,39 @@ showdown (new converter) completed in 75617ms. markdown-js completed in 70069ms. ``` +__UPDATE:__ Apparently Google optimized v8 very well somewhere between when +node v0.4.10 and node v0.6.0 were released. Unfortunately they didn't +seem to optimize my code. marked is still faster than everything (except +Discount and C modules most likely), however, it's not supremely better, +like it used to be. For example, its only roughly twice as fast as +markdown-js now. + +node v0.6.x + +``` bash +$ node test --bench +marked completed in 11998ms. +showdown (reuse converter) completed in 15686ms. +showdown (new converter) completed in 18014ms. +markdown-js completed in 23520ms. +``` + +Benchmarks for other engines to come (?). + ## Install ``` bash $ npm install marked ``` -# Another javascript markdown parser +## Another javascript markdown parser The point of marked was to create a markdown compiler where it was possible to frequently parse huge chunks of markdown without having to worry about caching the compiled output somehow...or blocking for an unnecesarily long time. -marked lingers around 430 (may vary) lines long and still implements all -markdown features. It is also now fully compatible with the client-side. +marked is very concise and still implements all markdown features. It is also +now fully compatible with the client-side. marked more or less passes the official markdown test suite in its entirety. This is important because a surprising number of markdown compilers @@ -59,11 +80,17 @@ $ node links: {} ] ``` -## Todo (& notes to self) +## CLI + +``` bash +$ marked -o hello.html +hello world +^D +$ cat hello.html +
hello world
+``` + +## Todo - Implement GFM features. -- Possibly add some - [ReMarkable](http://camendesign.com/code/remarkable/documentation.html) - features while remaining backwardly compatible with all markdown syntax. -- Optimize the lexer to return an iterator instead of a collection of tokens. - Add an explicit pretty printing and minification feature. diff --git a/test/index.js b/test/index.js index a43aa392..97e074b2 100644 --- a/test/index.js +++ b/test/index.js @@ -53,8 +53,6 @@ main: filename = keys[i_]; file = files[filename]; - // this was messing with - // `node test | less` on sakura try { text = marked(file.text).replace(/\s/g, ''); html = file.html.replace(/\s/g, ''); @@ -142,9 +140,9 @@ var bench = function() { })(); main.bench('showdown (new converter)', showdown_slow); - var markdownjs = require('markdown-js'); + var markdownjs = require('markdown'); main.bench('markdown-js', function(text) { - markdownjs.toHTML(text); + markdownjs.parse(text); }); }; @@ -179,9 +177,9 @@ var old_bench = function() { showdown_(text); }); - var markdownjs_ = require('markdown-js'); + var markdownjs_ = require('markdown'); benchmark(function markdownjs() { - markdownjs_.toHTML(text); + markdownjs_.parse(text); }); };