JsDoc Toolkit released version 2.3.2 not long ago, which mainly fixes the previous version.
If you need to use Ant, JsDoc also has an Ant plug-in: JsDoc Toolkit Ant Task
Download JsDoc Toolkit2.3.2: http://jsdoc-toolkit.googlecode.com/ files/jsdoc_toolkit-2.3.2.zip
Command name description
@param @argument Specify the parameter name and description to describe a function parameter
@returns Describe the function The return value of
@author indicates the author of the code.
@deprecated indicates that a function has been deprecated and will be completely removed in a future version of the code. To avoid using this code
@see Create an HTML link pointing to the description of the specified class
@version Specify the release version
@requires Create an HTML link pointing to the specified class required by this class
@throws @exception Describes the type of exception that the function may throw
{@link} Creates an HTML link pointing to the specified class. This is similar to @see, but {@link} can be embedded in the comment text
@fileoverview This is a special tag. If this tag is used in the first documentation block of a file, it specifies that the remainder of the documentation block will be used to provide an overview of the file
@class provides information about the class, used in the documentation of the constructor
@constructor makes it clear that a function is the constructor of a certain class
@type specifies the return type of the function
@extends indicates that one class derives from another class. JSDoc can usually detect this information by itself, but in some cases it is necessary to use the tag
@private to indicate that a class or function is private. Private classes and functions will not appear in HTML documents unless the --private command line option is provided when running JSDoc
@final indicates that a value is a constant value. Remember that JavaScript cannot truly guarantee that a value is a constant
@ignore JSDoc ignores functions with this tag
JsDoc: is a js document generation tool that extracts classes, methods, and members from the javascript program source code The annotation information forms an API help document that matches the source code.
Java open source project http://www.jsdoctoolkit.org/, which is a powerful javascript document generation tool.
Let’s finish with how to use it.
We download the tool library.
Here we are using jsdoc_toolkit-2.1.0.zip which is the current highest version.
Let’s unzip this file. You can see the README.txt file inside.
Here are detailed instructions for use. [It seems that the introduction can be done here. Of course you can also continue reading]
Here we need to create a javascript document through the command line.
java -jar jsrun.jar app/run.js -a -e=GB18030 -t=templates/jsdoc test/*.js
Of course, if you find it more troublesome to use the command line, we can create one ourselves .bat file
Copy the above content into the file and execute it.
Let me briefly explain the parameters
-a represents all methods
-e represents the encoding root of the corresponding file, which corresponds to GB18030. The default is utf-8
-t Represents the document style template of the production doc
The test/*.js here represents all the javascript files in the test directory
After execution, the document results will be output to the /out/jsdoc directory by default. Of course, this directory can also be defined
The specific parameters can be viewed using
java -jar jsrun.jar app/run.js --help
.
The result is as follows: