特别是,我有兴趣排除任何node_modules
个文件夹,但还有其他文件夹需要排除。
这通常在配置文件中完成;例如,.jsdoc文件,如下所示:
"source": {
"include" : ["../projects"],
"includePattern": ".*src\\\\.+\\.js(doc|x)?$",
"excludePattern": "(node_modules|docs)"
}
答案 0 :(得分:1)
对我来说最好的方法是用@public
@private
等注释我的文档,然后传递选项--access: ['public', 'private']
选择性地包含我想要的部分。
--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