JsDoc
安装
npm install -g jsdoc
添加配置文件
doc.json
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"source": {
//生成文档要包含的文件
"include": [ "src/Page.js", "src/NavigateBar.js","README.md"],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(node_modules/|docs)"
},
"opts": {
//theme模板, same as -t templates/default
//"template": "templates/default",
"template": "node_modules/minami",
"encoding": "utf8",
// same as -e utf8
//输出目录, same as -d ./out/
"destination": "./docs/",
//是否显示私有方法
"private": false,
"recurse": true
// same as -r
//"tutorials": "./docs/tutorials" // same as -u path/to/tutorials
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": true
}
}
这里用到一个第三方主题 minami ,安装后才能使用
$ npm install --save-dev minami
其它模板: docstrap
jsdoc -c path/to/conf.json -t ./node_modules/ink-docstrap/template -R README.md -r .
执行
$ jsdoc -c doc.json