Created
January 2, 2013 06:34
-
-
Save lucifr/4432697 to your computer and use it in GitHub Desktop.
markdown.js for hexo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var marked = require('marked'), | |
mdiscn = require('discount'), | |
_ = require('underscore'), | |
highlight = require('../util').highlight, | |
extend = require('../extend'); | |
var regex = { | |
backtick: /^`{3}\s*([^\n]+)\n([^`]+)/, | |
captionUrl: /([^\s]+)\s*(.*)(https?:\/\/\S+)\s*(.*)/, | |
caption: /([^\s]+)\s*(.*)/ | |
}; | |
marked.setOptions({ | |
gfm: true, | |
pedantic: false, | |
sanitize: false, | |
highlight: function(code, lang){ | |
return highlight(code, {lang: lang, gutter: false}); | |
} | |
}); | |
var markdown = function(file, content){ | |
return mdiscn.parse(content, mdiscn.flags.extraFootnote); | |
}; | |
extend.renderer.register('md', 'html', markdown, true); | |
extend.renderer.register('markdown', 'html', markdown, true); | |
extend.renderer.register('mkd', 'html', markdown, true); | |
extend.renderer.register('mkdn', 'html', markdown, true); | |
extend.renderer.register('mdwn', 'html', markdown, true); | |
extend.renderer.register('mdtxt', 'html', markdown, true); | |
extend.renderer.register('mdtext', 'html', markdown, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment