特别是,我感兴趣的是排除任何node_modules
文件夹,但也有其他需要被排除在外。
这通常是完成在配置文件;例如,一个文件.jsdoc,像这样:
"source": {
"include" : ["../projects"],
"includePattern": ".*src\\\\.+\\.js(doc|x)?$",
"excludePattern": "(node_modules|docs)"
}
为我工作的最好办法是注释我与@public
@private
等文档,然后通过选择--access: ['public', 'private']
选择性地包括我想要的作品。
作为比肩documentation
--access, -a Include only comments with a given access level,
out of private, protected, public, undefined. By
default, public, protected, and undefined access
levels are included
[array] [choices: "public", "private", "protected", "undefined"]
你可以写一个脚本以编程方式生成的文档
documentation
.build('src/index.js', { access: ["public"] })
.then(documentation.formats.md)
.then(markdown => {
fs.writeFileSync('README.md'), markdown);
})
.catch(error => console.error(error));
编辑:
只要是明确的,这里是如何利用控制台命令 -
documentation build ./src/index.js --access private public protected -f html -o docs