生成jsdoc文档 [英] Generate jsdoc documentation

查看:49
本文介绍了生成jsdoc文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行搜索以了解javascript文档生成器jsdoc的操作方式.使用它时,我的所有文档文件始终都位于index.js上,而文件,类或模块中却没有导航(位于文档网站中).此外,我还有一些未在文档中出现的标签.但是,我只使用usejsdoc网站( jsdoc的文档)中给出的标签.

I search to understand how operate jsdoc, the generator of javascript documentation. 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. 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).

版本:

  • Node.js:6.9.1
  • jsdoc:3.4.2

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'),

希望你能帮助我.

最诚挚的问候

推荐答案

我通过将脚本添加到package.json

"scripts": {
  ...
  "docs": "./node_modules/jsdoc/jsdoc.js -c ./.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
  }
}

这将在项目根目录的./docs文件夹中生成文档.

this generates the docs in a folder ./docs in the root of the project.

然后您可以通过运行npm run docs来生成项目文档.

You can then generate project docs by running npm run docs.

您可能还想gitignore生成的文档.有关完整的配置选项,请阅读 http://usejsdoc.org/about-configuring-jsdoc.html

You may also want to gitignore the generated docs. For full configuration options read http://usejsdoc.org/about-configuring-jsdoc.html

这篇关于生成jsdoc文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆