documentation/lib/output/markdown.js
Titus Wormer 35e17be4e4 Rename mdast to remark
Note that the AST now carries the name “mdast”, meaning
utilities (such as mdast-util-inject) keep their name.

This name-change includes the `mdast` formatter, which also changed
to `remark`.

Additionally:

* Update relating packages.
* Fix a bug where `text` nodes without value were
  [generated](6b905aefb1/lib/output/markdown_ast.js (L144)).
2016-01-24 10:35:51 -05:00

24 lines
704 B
JavaScript

'use strict';
var remark = require('remark'),
toc = require('remark-toc'),
markdownAST = require('./markdown_ast');
/**
* 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 {Function} callback called with null, string
* @name markdown
* @return {undefined} calls callback
*/
module.exports = function (comments, opts, callback) {
var processor = remark().use(toc);
markdownAST(comments, opts, function (err, ast) {
var processedAST = processor.run(ast);
return callback(null, processor.stringify(processedAST));
});
};