You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

  1. // Generated by CoffeeScript 1.4.0
  2. var __hasProp = {}.hasOwnProperty,
  3. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
  4. module.exports = function(BasePlugin) {
  5. var MarkedPlugin;
  6. return MarkedPlugin = (function(_super) {
  7. __extends(MarkedPlugin, _super);
  8. function MarkedPlugin() {
  9. return MarkedPlugin.__super__.constructor.apply(this, arguments);
  10. }
  11. MarkedPlugin.prototype.name = 'marked';
  12. MarkedPlugin.prototype.config = {
  13. markedOptions: {
  14. pedantic: false,
  15. gfm: true,
  16. sanitize: false,
  17. highlight: null
  18. }
  19. };
  20. MarkedPlugin.prototype.render = function(opts, next) {
  21. var config, inExtension, marked, outExtension;
  22. config = this.config;
  23. inExtension = opts.inExtension, outExtension = opts.outExtension;
  24. if ((inExtension === 'md' || inExtension === 'markdown') && (outExtension === null || outExtension === 'html')) {
  25. marked = require('marked');
  26. marked.setOptions(config.markedOptions);
  27. opts.content = marked(opts.content);
  28. }
  29. return next();
  30. };
  31. return MarkedPlugin;
  32. })(BasePlugin);
  33. };