A JavaScript Markdown Parser.
Install patchmark
package with bower:
$ bower install patchmark --save
Example:
<!DOCTYPE html>
<html>
<body>
<textarea id="editor" style="width:400px;height:100px;">
Type some **markdown** here.
</textarea>
<div id="preview"></div>
<script type="text/javascript" src="bower_components/patchmark/dist/patchmark.min.js"></script>
<script type="text/javascript">
function markdown() {
var $preview = $("preview"),
$editor = $("editor");
function $(id) {
return document.getElementById(id);
}
function update() {
$preview.innerHTML = patchmark.parse($editor.value);
}
$editor.oninput = update;
update();
}
markdown();
</script>
</body>
</html>
Clone a copy of the repository:
$ git clone git://github.com/hidcliff/patchmark.git
Enter the patchmark directory, install dependencies, and run grunt
command:
$ cd patchmark
$ npm install
$ grunt
The /dist
subdirectory will be created and new copy will be put in the directory, along with the minified copy.
Enter the test directory and install dependencies for Unit Tests:
$ cd test
$ bower install
Run index.html
in a browser
grunt test