aboutsummaryrefslogtreecommitdiff
path: root/js/bin/markdown
blob: 37b0e520189956c0f73393ee647abf7398d93de1 (plain)
  1. #!/usr/bin/env node
  2. var fs = require('fs');
  3. var util = require('util');
  4. var commonmark = require('../lib/index.js');
  5. file = process.argv[2] || '/dev/stdin';
  6. fs.readFile(file, 'utf8', function(err, data) {
  7. if (err) {
  8. return console.log(err);
  9. }
  10. var parser = new commonmark.DocParser();
  11. var renderer = new commonmark.HtmlRenderer();
  12. process.stdout.write(renderer.render(parser.parse(data)));
  13. });