我正在使用 JSDoc 和 Docstrap 记录一个项目。
当文档组织为(2)个JS文件(或模块)时,生成的文档就可以了。每个模块列出两个(类)。
接下来,除了“模块”之外,我还添加了“命名空间” a 但是,现在 html 页面中每个模块列出的类消失了。
问题: 如何让 JSDoc 继续在模块 html 页面中包含类列表。
JS 文件:“ModuleFile01.js”、“ModuleFile02.js”
ModuleFile01.js
/**
* @module Part1/Section01
* @description Section 01 of Part1
*/
/**
* Class 1.01
*/
class Part1Class1 {
/**
* Constructor
*/
constructor() {}
}
/**
* Class 1.02
*/
class Part1Class2 {
/**
* Constructor
*/
constructor() {}
}
ModuleFile02.js
/**
* @module Part1/Section02
* @description Section 02 of Part1
*/
/**
* Class 1.02
*/
class Part1Class3 {
/**
* Constructor
*/
constructor() {}
}
/**
* Class 1.02
*/
class Part1Class4 {
/**
* Constructor
*/
constructor() {}
{
"recurseDepth": 10,
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_|.+\\.min.js"
},
"sourceType": "module",
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"plugins":
[ "plugins/markdown"
],
"templates": {
"outputSourceFiles": true,
"outputSourcePath": false,
"cleverLinks": false,
"monospaceLinks": false,
"dateFormat": "YYYY-MM-DD HH:MM",
"systemName": "Test project",
"footer": "",
"copyright": "DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.",
"navType": "vertical",
"theme": "readable",
"linenums": true,
"collapseSymbols": false,
"inverseNav": true,
"protocol": "html://",
"methodHeadingReturns": false
},
"markdown": {
"parser": "gfm",
"hardwrap": true
}
}
DEBUG: JSDoc 3.5.5 (Thu, 14 Sep 2017 02:51:54 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":["plugins/markdown"],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"(^|\\/|\\\\)_|.+\\.min.js"},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"outputSourceFiles":true,"outputSourcePath":false,"dateFormat":"YYYY-MM-DD HH:MM","systemName":"Test project","footer":"","copyright":"DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.","navType":"vertical","theme":"readable","linenums":true,"collapseSymbols":false,"inverseNav":true,"protocol":"html://","methodHeadingReturns":false},"markdown":{"parser":"gfm","hardwrap":true}},"opts":{"_":["src"],"configure":"JSDoc.cfg.json","template":"C:/Users/cpass/node_modules/ink-docstrap/template","destination":"doc","recurse":true,"verbose":true,"debug":true,"encoding":"utf8"}}}
DEBUG: Parsing source files: ["D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test01\\src\\ModuleFile01.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test01\\src\\ModuleFile02.js"]
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test01\src\ModuleFile01.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test01\src\ModuleFile02.js ...
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...
Finished running in 0.48 seconds.
JS 文件:“Cat-Classes”、“ModuleFile01.js”、“ModuleFile02.js”
Cat-Classes.js(只有文档,无代码)
/**
* @namespace sections
* @description Section 01 and 02 of Part1
* The html page for this namespace lists all classes from "Module01.js" and "Module01.js".
*/
ModuleFile01.js
/**
* @module Part1/Section01
* @description Section 01 of Part1
*/
/**
* Class 1.01
* @memberof sections
*/
class Part1Class1 {
/**
* Constructor
*/
constructor() {}
}
/**
* Class 1.02
* @memberof sections
*/
class Part1Class2 {
/**
* Constructor
*/
constructor() {}
}
ModuleFile02.js
/**
* @module Part1/Section02
* @description Section 02 of Part1
*/
/**
* Class 1.02
* @memberof sections
*/
class Part1Class3 {
/**
* Constructor
*/
constructor() {}
}
/**
* Class 1.02
* @memberof sections
*/
class Part1Class4 {
/**
* Constructor
*/
constructor() {}
}
DEBUG: JSDoc 3.5.5 (Thu, 14 Sep 2017 02:51:54 GMT)
DEBUG: Environment info: {"env":{"conf":{"plugins":["plugins/markdown"],"recurseDepth":10,"source":{"includePattern":".+\\.js(doc|x)?$","excludePattern":"(^|\\/|\\\\)_|.+\\.min.js"},"sourceType":"module","tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"outputSourceFiles":true,"outputSourcePath":false,"dateFormat":"YYYY-MM-DD HH:MM","systemName":"Test project","footer":"","copyright":"DocStrap Copyright © 2012-2015 The contributors to the JSDoc3 and DocStrap projects.","navType":"vertical","theme":"readable","linenums":true,"collapseSymbols":false,"inverseNav":true,"protocol":"html://","methodHeadingReturns":false},"markdown":{"parser":"gfm","hardwrap":true}},"opts":{"_":["src"],"configure":"JSDoc.cfg.json","template":"C:/Users/cpass/node_modules/ink-docstrap/template","destination":"doc","recurse":true,"verbose":true,"debug":true,"encoding":"utf8"}}}
DEBUG: Parsing source files: ["D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\Cat-Classes.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\ModuleFile01.js","D:\\JavaProjects\\JavaScript\\LWPS\\docs\\test02\\src\\ModuleFile02.js"]
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\Cat-Classes.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\ModuleFile01.js ...
Parsing D:\JavaProjects\JavaScript\LWPS\docs\test02\src\ModuleFile02.js ...
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...
Finished running in 0.51 seconds.
我正在使用 JSDoc 和 Docstrap 记录一个项目。
创建的项目包含两 (2) 个 JS 文件(或模块),每个 JS 文件包含两 (2) 个类。 每个模块网页列出了模块内的类。
我成功创建了一个包含模块的文档,以及一个“命名空间”,其中列出了文件 ModuleFile01.js 和 ModuleFile02.js 中的所有类
我刚刚创建了一个 JS 文件,没有代码,只有文档。
现在,文档包含一个列出所有项目类的“命名空间”。 但是,现在 html 页面中每个模块列出的类消失了。
问题: 如何让 JSDoc 继续在模块 html 页面中包含类列表。
|软件|版本 | | :-------------- | :------ | | JSDoc | JSDoc 3.5.5(2017 年 9 月 14 日星期四 02:51:54 GMT)| | Node.js | v10.15.0 | | npm | 6.4.1 | |操作系统 | Windows 10 专业版,64 位,版本 1809(操作系统内部版本 17763.503)|
您可能想要的是
* @memberof module:Part1/Section01
替换上面的
* @memberof sections
。
namepath文档的特殊情况:模块、外部和事件部分解释了对
module:...
前缀的需求。