bin, tests

This commit is contained in:
Christopher Jeffrey 2011-08-10 21:50:25 -05:00
parent 902686c0e2
commit 457adda267
6 changed files with 23 additions and 28 deletions

View File

@ -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
of this software and associated documentation files (the "Software"), to deal

View File

@ -18,17 +18,23 @@ marked lingers around 350 lines long and still implements all markdown features.
## Install
``` bash
$ npm install marked
```
## Usage
``` js
var marked = require('marked');
console.log(marked('i am using __markdown__.'));
```
You also have direct access to the lexer and parser if you so desire.
var tokens = md.lexer(str);
console.log(md.parser(tokens));
``` js
var tokens = marked.lexer(str);
console.log(marked.parser(tokens));
```
## Todo (& notes to self)

View File

@ -4,6 +4,7 @@
"author": "Christopher Jeffrey",
"version": "0.0.1",
"main": "./lib/marked.js",
"bin": { "marked": "./bin/marked" },
"repository": "git://github.com/chjj/marked.git",
"keywords": [ "markdown", "markup" ]
}

View File

@ -8,9 +8,9 @@ var benchmark = function(func, t) {
console.log('%s: %sms', func.name, new Date() - start);
};
var md_ = require('../');
benchmark(function md() {
md_(text);
var marked_ = require('../');
benchmark(function marked() {
marked_(text);
});
var showdown_ = require('showdown');

View File

@ -8,11 +8,12 @@ var md = require('../')
, text = fs.readFileSync(__dirname + '/in.md', 'utf8');
var a = md(text)
, b = fs.readFileSync(__dirname + '/out.md', 'utf8');
, b = fs.readFileSync(__dirname + '/out.html', 'utf8');
console.log(a);
console.log('----------------------------------------------------------------');
console.log(b);
console.log('----------------------------------------------------------------');
a = a.replace(/\s+/g, '');
b = b.replace(/\s+/g, '');

View File

@ -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>