[英]Generate jsdoc documentation
I search to understand how operate jsdoc, the generator of javascript documentation. 我搜索了解如何操作jsdoc,javascript文档的生成器。 When I use it, I have always all my documentation files on index.js and never the navigation (in the documentation web site) in my files, classes or modules.
当我使用它时,我总是在index.js上的所有文档文件,而不是我的文件,类或模块中的导航(在文档网站中)。 Furthermore, I have also some tags which do not appear in the documentation.
此外,我还有一些标签没有出现在文档中。 However, I use just the tags given by usejsdoc web site ( documentation of jsdoc ).
但是,我只使用usejsdoc网站( jsdoc的文档 )给出的标签。
Version : 版本:
Server.js Server.js
"use strict";
/**
* @module server
* @file
* The main file of this server. It create access routes. To use it, you can write on a terminal : $ node server.js <br />
* Turn in javascript strict mode. <br />
*
* @version 1.0
* @since 1.0
*
* @requires config
* @requires express
* @requires body-parser
* @requires messenger.scenario
* @requires messenger.routeMessenger
*/
const
// Official libraries
/**
* @access public
* @constant
* @description Use config file to param server.
*/
config = require("config"),
express = require('express'),
bodyParser = require('body-parser'),
I hope you can help me. 我希望你能帮助我。
Best regards 最好的祝福
I add jsdocs to typical javascript project by adding a script to package.json
我通过向
package.json
添加一个脚本,将jsdocs添加到典型的javascript项目中
"scripts": {
...
"docs": "./node_modules/jsdoc/jsdoc.js -c ./.jsdoc.conf.json"
}
and add a config file .jsdoc.conf.json
并添加配置文件
.jsdoc.conf.json
{
"plugins": [],
"recurseDepth": 10,
"opts": {
"recurse": true,
"destination": "./docs/"
},
"source": {
"include": ["src"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "node_modules"
},
"sourceType": "module",
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false
}
}
this generates the docs in a folder ./docs
in the root of the project. 这会在项目根目录中的
./docs
文件夹中生成文档。
You can then generate project docs by running npm run docs
. 然后,您可以通过运行
npm run docs
生成项目npm run docs
。
You may also want to gitignore the generated docs. 您可能还想要生成生成的文档。 For full configuration options read http://usejsdoc.org/about-configuring-jsdoc.html
有关完整配置选项,请阅读http://usejsdoc.org/about-configuring-jsdoc.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.