marked/README.md

58 lines
1.6 KiB
Markdown
Raw Normal View History

2011-07-24 08:15:35 -05:00
# marked
2011-08-14 03:34:10 -05:00
A full-featured markdown parser and compiler implemented in ~430 lines of JS.
2011-07-24 08:15:35 -05:00
Built for speed.
## Benchmarks
2011-08-10 21:52:54 -05:00
``` bash
2011-08-23 00:07:50 -05:00
$ node test --old_bench
2011-08-10 21:52:54 -05:00
marked: 6260ms
showdown: 21665ms
markdownjs: 69168ms
```
2011-07-24 08:15:35 -05:00
2011-08-23 00:07:50 -05:00
(Above is the old benchmark, try `node test --bench` for the new ones.)
2011-07-24 08:15:35 -05:00
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.
2011-08-14 03:34:10 -05:00
marked lingers around 430 (may vary) lines long and still implements all
markdown features. It is also now fully compatible with the client-side.
2011-07-24 08:15:35 -05:00
2011-08-23 00:07:50 -05:00
marked more or less passes the official markdown test suite in its
entirety. This is important because a surprising number of markdown compilers
cannot pass more than a few tests.
2011-07-24 08:15:35 -05:00
## Install
2011-08-10 21:50:25 -05:00
``` bash
$ npm install marked
```
2011-07-24 08:15:35 -05:00
## Usage
2011-08-10 21:50:25 -05:00
``` js
var marked = require('marked');
console.log(marked('i am using __markdown__.'));
```
2011-07-24 08:15:35 -05:00
You also have direct access to the lexer and parser if you so desire.
2011-08-10 21:50:25 -05:00
``` js
var tokens = marked.lexer(str);
console.log(marked.parser(tokens));
```
2011-07-24 08:15:35 -05:00
## Todo (& notes to self)
- Implement GFM features.
- Possibly add some
[ReMarkable](http://camendesign.com/code/remarkable/documentation.html)
features while remaining backwardly compatible with all markdown syntax.
2011-08-15 21:14:51 -05:00
- Optimize the parser so it accepts a stream of tokens from the lexer. This
should enhance performance even further, although, no lookaheads would
be possible.
2011-07-24 08:15:35 -05:00
- Add an explicit pretty printing and minification feature.