bin, tests
This commit is contained in:
parent
902686c0e2
commit
457adda267
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2011, Christopher Jeffrey (http://epsilon-not.net/)
|
Copyright (c) 2011, Christopher Jeffrey (https://github.com/chjj/)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
10
README.md
10
README.md
@ -18,17 +18,23 @@ marked lingers around 350 lines long and still implements all markdown features.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
``` bash
|
||||||
$ npm install marked
|
$ npm install marked
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
``` js
|
||||||
var marked = require('marked');
|
var marked = require('marked');
|
||||||
console.log(marked('i am using __markdown__.'));
|
console.log(marked('i am using __markdown__.'));
|
||||||
|
```
|
||||||
|
|
||||||
You also have direct access to the lexer and parser if you so desire.
|
You also have direct access to the lexer and parser if you so desire.
|
||||||
|
|
||||||
var tokens = md.lexer(str);
|
``` js
|
||||||
console.log(md.parser(tokens));
|
var tokens = marked.lexer(str);
|
||||||
|
console.log(marked.parser(tokens));
|
||||||
|
```
|
||||||
|
|
||||||
## Todo (& notes to self)
|
## Todo (& notes to self)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"author": "Christopher Jeffrey",
|
"author": "Christopher Jeffrey",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"main": "./lib/marked.js",
|
"main": "./lib/marked.js",
|
||||||
|
"bin": { "marked": "./bin/marked" },
|
||||||
"repository": "git://github.com/chjj/marked.git",
|
"repository": "git://github.com/chjj/marked.git",
|
||||||
"keywords": [ "markdown", "markup" ]
|
"keywords": [ "markdown", "markup" ]
|
||||||
}
|
}
|
@ -8,9 +8,9 @@ var benchmark = function(func, t) {
|
|||||||
console.log('%s: %sms', func.name, new Date() - start);
|
console.log('%s: %sms', func.name, new Date() - start);
|
||||||
};
|
};
|
||||||
|
|
||||||
var md_ = require('../');
|
var marked_ = require('../');
|
||||||
benchmark(function md() {
|
benchmark(function marked() {
|
||||||
md_(text);
|
marked_(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
var showdown_ = require('showdown');
|
var showdown_ = require('showdown');
|
||||||
|
@ -8,11 +8,12 @@ var md = require('../')
|
|||||||
, text = fs.readFileSync(__dirname + '/in.md', 'utf8');
|
, text = fs.readFileSync(__dirname + '/in.md', 'utf8');
|
||||||
|
|
||||||
var a = md(text)
|
var a = md(text)
|
||||||
, b = fs.readFileSync(__dirname + '/out.md', 'utf8');
|
, b = fs.readFileSync(__dirname + '/out.html', 'utf8');
|
||||||
|
|
||||||
console.log(a);
|
console.log(a);
|
||||||
console.log('----------------------------------------------------------------');
|
console.log('----------------------------------------------------------------');
|
||||||
console.log(b);
|
console.log(b);
|
||||||
|
console.log('----------------------------------------------------------------');
|
||||||
|
|
||||||
a = a.replace(/\s+/g, '');
|
a = a.replace(/\s+/g, '');
|
||||||
b = b.replace(/\s+/g, '');
|
b = b.replace(/\s+/g, '');
|
||||||
|
13
test/out.md
13
test/out.md
@ -1,13 +0,0 @@
|
|||||||
<h1>A heading</h1>
|
|
||||||
<p>Just a note, I've found that I can't test my markdown parser vs others. For example, both markdown.js and showdown code blocks in lists wrong. They're also completely <a href="http://google.com/" title="Google">inconsistent</a> with regards to paragraphs in list items.</p>
|
|
||||||
<p>A link</p>
|
|
||||||
<aside>this will make me fail the test because
|
|
||||||
markdown.js doesnt acknowledge arbitrary html blocks =/</aside>
|
|
||||||
<ul><li>List Item 1</li><li>List Item 2 <ul><li>New List Item 1 Hi, this is a list item.</li><li>New List Item 2 Another item <pre><code>Code goes here.
|
|
||||||
Lots of it...</code></pre></li><li>New List Item 3 The last item</li></ul></li><li>List Item 3 The final item.</li></ul>
|
|
||||||
<blockquote><ul><li>bq Item 1</li><li>bq Item 2 <ul><li>New bq Item 1</li><li>New bq Item 2 Text here</li></ul></li></ul></blockquote>
|
|
||||||
<blockquote><p> Another blockquote To quoth someone and whatnot markdown.js breaks here again</p></blockquote>
|
|
||||||
<h2>Another Heading</h2>
|
|
||||||
<p>Hello <em>world</em>. Here is a <a href="//hello">link</a>. And an image <img src="src" alt="alt">.</p>
|
|
||||||
<pre><code>Code goes here.
|
|
||||||
Lots of it...</code></pre>
|
|
Loading…
x
Reference in New Issue
Block a user