JSDoc 不解析以逗号为前缀的元素
JSDoc don't parse elements prefixed with a comma
我正在使用以下 test.js
文件尝试 JSDoc 和 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 正确输出了 doc(出现了两个函数),但 JSDoc 只输出了一个,如以下屏幕截图所示:
博士:
JSDoc:
知道为什么会这样吗?
看来问题出在comma first style. There's a bug opened since 2013 with this: https://github.com/jsdoc3/jsdoc/issues/446
如果我从 divide
函数的行首删除逗号并将其添加到 multiply
函数的右大括号之后,JSDoc 会正确生成文档:
编辑: 添加 GitHub 问题 link。
我创建了一个 JSDoc 插件来支持逗号优先样式:
https://github.com/Booster2ooo/jsdoc-comma-first
希望对您有所帮助。
我正在使用以下 test.js
文件尝试 JSDoc 和 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 正确输出了 doc(出现了两个函数),但 JSDoc 只输出了一个,如以下屏幕截图所示:
博士:
JSDoc:
知道为什么会这样吗?
看来问题出在comma first style. There's a bug opened since 2013 with this: https://github.com/jsdoc3/jsdoc/issues/446
如果我从 divide
函数的行首删除逗号并将其添加到 multiply
函数的右大括号之后,JSDoc 会正确生成文档:
编辑: 添加 GitHub 问题 link。
我创建了一个 JSDoc 插件来支持逗号优先样式: https://github.com/Booster2ooo/jsdoc-comma-first
希望对您有所帮助。