Cleaning up
Make benchmarks work with npm markdown-js Clean todo list Clean up readme Add new benchmarks Dont count lines in the readme Add CLI example in readme
This commit is contained in:
parent
02a6a99121
commit
83d114730a
45
README.md
45
README.md
@ -1,10 +1,12 @@
|
|||||||
# marked
|
# marked
|
||||||
|
|
||||||
A full-featured markdown parser and compiler implemented in ~430 lines of JS.
|
A full-featured markdown parser and compiler.
|
||||||
Built for speed.
|
Built for speed.
|
||||||
|
|
||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
|
node v0.4.x
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ node test --bench
|
$ node test --bench
|
||||||
marked completed in 12071ms.
|
marked completed in 12071ms.
|
||||||
@ -13,20 +15,39 @@ showdown (new converter) completed in 75617ms.
|
|||||||
markdown-js completed in 70069ms.
|
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
|
## Install
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
$ npm install marked
|
$ 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
|
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
|
frequently parse huge chunks of markdown without having to worry about
|
||||||
caching the compiled output somehow...or blocking for an unnecesarily long time.
|
caching the compiled output somehow...or blocking for an unnecesarily long time.
|
||||||
|
|
||||||
marked lingers around 430 (may vary) lines long and still implements all
|
marked is very concise and still implements all markdown features. It is also
|
||||||
markdown features. It is also now fully compatible with the client-side.
|
now fully compatible with the client-side.
|
||||||
|
|
||||||
marked more or less passes the official markdown test suite in its
|
marked more or less passes the official markdown test suite in its
|
||||||
entirety. This is important because a surprising number of markdown compilers
|
entirety. This is important because a surprising number of markdown compilers
|
||||||
@ -59,11 +80,17 @@ $ node
|
|||||||
links: {} ]
|
links: {} ]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Todo (& notes to self)
|
## CLI
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
$ marked -o hello.html
|
||||||
|
hello world
|
||||||
|
^D
|
||||||
|
$ cat hello.html
|
||||||
|
<p>hello world</p>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Todo
|
||||||
|
|
||||||
- Implement GFM features.
|
- 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.
|
- Add an explicit pretty printing and minification feature.
|
||||||
|
@ -53,8 +53,6 @@ main:
|
|||||||
filename = keys[i_];
|
filename = keys[i_];
|
||||||
file = files[filename];
|
file = files[filename];
|
||||||
|
|
||||||
// this was messing with
|
|
||||||
// `node test | less` on sakura
|
|
||||||
try {
|
try {
|
||||||
text = marked(file.text).replace(/\s/g, '');
|
text = marked(file.text).replace(/\s/g, '');
|
||||||
html = file.html.replace(/\s/g, '');
|
html = file.html.replace(/\s/g, '');
|
||||||
@ -142,9 +140,9 @@ var bench = function() {
|
|||||||
})();
|
})();
|
||||||
main.bench('showdown (new converter)', showdown_slow);
|
main.bench('showdown (new converter)', showdown_slow);
|
||||||
|
|
||||||
var markdownjs = require('markdown-js');
|
var markdownjs = require('markdown');
|
||||||
main.bench('markdown-js', function(text) {
|
main.bench('markdown-js', function(text) {
|
||||||
markdownjs.toHTML(text);
|
markdownjs.parse(text);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -179,9 +177,9 @@ var old_bench = function() {
|
|||||||
showdown_(text);
|
showdown_(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
var markdownjs_ = require('markdown-js');
|
var markdownjs_ = require('markdown');
|
||||||
benchmark(function markdownjs() {
|
benchmark(function markdownjs() {
|
||||||
markdownjs_.toHTML(text);
|
markdownjs_.parse(text);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user