diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-10-18 16:16:49 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-10-18 16:31:59 -0700 |
commit | 3b54fe244535a791a8f8d8bf6d367a5ebb2d47b6 (patch) | |
tree | 2f7dddf7abaa8213b36d5f5111b67a72bd1eabf7 /js/bin | |
parent | f9e91b6d2d0837a331ce0c60609997b436e7f224 (diff) |
Use browserify to make js code more modular.
* Moved js library code to `js/lib`.
* `js/stmd.js` is now generated from these files using browserify.
* Factored out `html5-entities.js` and `from-code-point.js` from main
js parsing code (which is now `index.js`).
* Moved `js/markdown` to `js/bin`.
Diffstat (limited to 'js/bin')
-rwxr-xr-x | js/bin/markdown | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/js/bin/markdown b/js/bin/markdown new file mode 100755 index 0000000..31b7ce4 --- /dev/null +++ b/js/bin/markdown @@ -0,0 +1,15 @@ +#!/usr/bin/env node +var fs = require('fs'); +var util = require('util'); +var stmd = require('../lib/index.js'); + +file = process.argv[2] || '/dev/stdin'; + +fs.readFile(file, 'utf8', function(err, data) { + if (err) { + return console.log(err); + } + var parser = new stmd.DocParser(); + var renderer = new stmd.HtmlRenderer(); + process.stdout.write(renderer.render(parser.parse(data))); +}); |