diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/bin/commonmark | 9 | ||||
-rwxr-xr-x | js/lib/index.js | 11 |
2 files changed, 6 insertions, 14 deletions
diff --git a/js/bin/commonmark b/js/bin/commonmark index 6570ef6..f40c37a 100755 --- a/js/bin/commonmark +++ b/js/bin/commonmark @@ -1,6 +1,7 @@ #!/usr/bin/env node "use strict"; +var util = require('util'); var fs = require('fs'); var commonmark = require('../lib/index.js'); @@ -37,8 +38,10 @@ if (format === 'html') { } else if (format === 'xml') { renderer = new commonmark.XMLRenderer(options); } else if (format === 'ast') { - renderer = new commonmark.ASTRenderer(options); - renderer.options.colors = true; + renderer = { render: function(node) { + return util.inspect(node.toAST(), null, 20, true) + '\n'; + }, + options: {} }; } if (files.length === 0) { @@ -55,4 +58,4 @@ var doc = parser.parse(inp); var rendered = renderer.render(doc); -if (!options.time) { process.stdout.write(rendered); }
\ No newline at end of file +if (!options.time) { process.stdout.write(rendered); } diff --git a/js/lib/index.js b/js/lib/index.js index b309311..05c7b72 100755 --- a/js/lib/index.js +++ b/js/lib/index.js @@ -11,18 +11,7 @@ "use strict"; -var util = require('util'); - module.exports.Node = require('./node'); module.exports.DocParser = require('./blocks'); module.exports.HtmlRenderer = require('./html'); module.exports.XMLRenderer = require('./xml'); -module.exports.ASTRenderer = function(options) { - return { - render: function(tree) { - return util.inspect(tree.toAST(), null, 20, - this.options.colors) + '\n'; - }, - options: options || {} - }; -} |