我正在使用下面的JSDoc文件和Docco文件来尝试test.js和Docco:
/**
* @fileOverview Various tool functions.
* @author <a href="mailto:jd@example.com">John Doe</a>
* @version 3.1.2
*/
/** @namespace util */
var util = {
// ## Multiply ##
// with this function you can make amazing multiplications!
/**
* Multiplies two numbers
* @param {int} a - a number
* @param {int} b - another number
* @returns {int}
* @example
* var m = util.multiply(2, 3); // 6
*/
multiply: function (a, b){
return a * b;
}
// ## Divide ##
// with this function you can divide two numbers
/**
* Divides two numbers.
* @param {int} a - a number
* @param {int} b - another number
* @returns {int} a/b
*/
, divide: function (a, b) {
// note that if the numbers are not divisible, the result will be a float.
return a / b;
}
};Docco正确地输出文档(两个函数都出现),但是JSDoc只输出一个,如下面的屏幕截图所示:
Docco:

JSDoc:

知道为什么会这样吗?
发布于 2015-07-31 21:45:50
问题似乎是逗号第一样式。自2013年以来,有一个bug被打开了:https://github.com/jsdoc3/jsdoc/issues/446
如果我用divide函数从行的乞讨中删除逗号,并在multiply函数的结束大括号之后添加逗号,那么JSDoc正确地生成文档:

编辑:添加GitHub发布链接。
发布于 2016-12-18 08:23:30
我创建了一个支持逗号第一风格的JSDoc插件:https://github.com/Booster2ooo/jsdoc-comma-first
希望能帮上忙。
https://stackoverflow.com/questions/31755672
复制相似问题