jsdoc/plugins/markdown.js
Jannon 393f6c9846 Beefier plugin documentation
Also updating the included plugins to export handlers in a "handlers" object.
2012-02-25 00:11:58 -08:00

22 lines
692 B
JavaScript

/**
@overview Translate doclet descriptions from MarkDown into HTML.
@module plugins/markdown
@author Michael Mathews <micmath@gmail.com>
*/
var mdParser = require('evilstreak/markdown');
exports.handlers = {
/**
Translate markdown syntax in a new doclet's description into HTML. Is run
by JSDoc 3 whenever a "newDoclet" event fires.
*/
newDoclet: function(e) {
if (e.doclet.description) {
e.doclet.description = mdParser.toHTML(e.doclet.description)
.replace( /&amp;/g, "&" ) // because markdown escapes these
.replace( /&lt;/g, "<" )
.replace( /&gt;/g, ">" );
}
}
};