summaryrefslogtreecommitdiff
path: root/js/bin/markdown
diff options
context:
space:
mode:
Diffstat (limited to 'js/bin/markdown')
-rwxr-xr-xjs/bin/markdown15
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)));
+});