aboutsummaryrefslogtreecommitdiff
path: root/js/lib/index.js
blob: b30931113777585a379c8cf2b5d8e5e9ab0f9399 (plain)
  1. // commonmark.js - CommomMark in JavaScript
  2. // Copyright (C) 2014 John MacFarlane
  3. // License: BSD3.
  4. // Basic usage:
  5. //
  6. // var commonmark = require('commonmark');
  7. // var parser = new commonmark.DocParser();
  8. // var renderer = new commonmark.HtmlRenderer();
  9. // console.log(renderer.render(parser.parse('Hello *world*')));
  10. "use strict";
  11. var util = require('util');
  12. module.exports.Node = require('./node');
  13. module.exports.DocParser = require('./blocks');
  14. module.exports.HtmlRenderer = require('./html');
  15. module.exports.XMLRenderer = require('./xml');
  16. module.exports.ASTRenderer = function(options) {
  17. return {
  18. render: function(tree) {
  19. return util.inspect(tree.toAST(), null, 20,
  20. this.options.colors) + '\n';
  21. },
  22. options: options || {}
  23. };
  24. }