mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-18 14:17:30 +00:00
27 lines
731 B
JavaScript
27 lines
731 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Formats documentation as
|
|
* [Markdown](http://daringfireball.net/projects/markdown/).
|
|
*
|
|
* @param {Array<Object>} comments parsed comments
|
|
* @param {Object} opts Options that can customize the output
|
|
* @param {String} [opts.template='../../share/markdown.hbs'] Path to a Handlebars template file that
|
|
* takes the place of the default.
|
|
* @param {Function} callback called with null, string
|
|
* @name markdown
|
|
* @return {undefined} calls callback
|
|
*/
|
|
module.exports = function (comments, opts, callback) {
|
|
|
|
opts = opts || {};
|
|
|
|
if (!opts.preserveErrors) {
|
|
comments.forEach(function (comment) {
|
|
delete comment.errors;
|
|
});
|
|
}
|
|
|
|
return callback(null, JSON.stringify(comments, null, 2));
|
|
};
|