summaryrefslogtreecommitdiff
path: root/js/bin/commonmark
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-24 11:07:01 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-24 11:07:01 -0800
commitd6c615f2680e79bbb76cc85a056aadfe3524513f (patch)
tree1df0b3fe4a85a6ffcbaf06809318fc40ed062708 /js/bin/commonmark
parent31530d93448bdf93c0797540a73c6b67586ad5e1 (diff)
Removed JS implementation, which is moving to its own repo:
<https://github.com/jgm/commonmark.js>
Diffstat (limited to 'js/bin/commonmark')
-rwxr-xr-xjs/bin/commonmark61
1 files changed, 0 insertions, 61 deletions
diff --git a/js/bin/commonmark b/js/bin/commonmark
deleted file mode 100755
index 629cd50..0000000
--- a/js/bin/commonmark
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env node
-"use strict";
-
-var util = require('util');
-var fs = require('fs');
-var commonmark = require('../lib/index.js');
-
-var inps = [];
-var file;
-var files = [];
-var options = { sourcepos: false, time: false };
-var format = 'html';
-var i;
-
-for (i = 2; i < process.argv.length; i++) {
- var arg = process.argv[i];
- if (arg === '--ast') {
- format = 'ast';
- } else if (arg === '--xml') {
- format = 'xml';
- } else if (arg === '--time') {
- options.time = true;
- } else if (arg === '--sourcepos') {
- options.sourcepos = true;
- } else if (/^--/.test(arg)) {
- process.stderr.write('Unknown option ' + arg + '\n');
- process.exit(1);
- } else {
- files.push(arg);
- }
-}
-
-var parser = new commonmark.Parser(options);
-var renderer;
-
-if (format === 'html') {
- renderer = new commonmark.HtmlRenderer(options);
-} else if (format === 'xml') {
- renderer = new commonmark.XmlRenderer(options);
-} else if (format === 'ast') {
- renderer = { render: function(node) {
- return util.inspect(node, null, 20, true) + '\n';
- },
- options: {} };
-}
-
-if (files.length === 0) {
- files = ['/dev/stdin'];
-}
-
-for (i = 0; i < files.length; i++) {
- file = files[i];
- inps.push(fs.readFileSync(file, 'utf8'));
-}
-
-var inp = inps.join('\n');
-var doc = parser.parse(inp);
-
-var rendered = renderer.render(doc);
-
-if (!options.time) { process.stdout.write(rendered); }