jsdoc/plugins/test/specs/markdown.js
Jannon a6f68d838c Plugin tests
Tests for the plugin framework as well as for the plugins shipping with JSDoc
2012-05-06 00:43:22 -07: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, ">" );
}
}
};