JavaScript document generation is a headache, but now there are open-source tools available to use -- jsdoc.
Its official site address: http://jsdoc.sourceforge.net/
Release version is: http://sourceforge.net/projects/jsdoc
Jsdoc is based on JavaScript Code Generate the corresponding help document for the annotation in, which defines a set of annotation label specifications. Therefore, when writing JavaScript code, comment based on the annotation tag that it recognizes.
The usage is as follows:
1. If the operating system is a Windows user, you need to configure the Perl environment. We recommend that you install ActivePerl. Linux/Unix users do not need to configure it.
2. Decompress jsdoc and enter the directory where jsdoc is located in the Command Prompt window. Use the following command to generate a document for JavaScript code.
Perl jsdoc. pl test. js
Test. JS is the JS file used for testing. If it succeeds, the js_docs_out directory is generated under this Directory, which contains the generated documents.
3. If the generation fails, the following error message is generated:
Can't locate html/template. PM in @ INC ......
You need to configure the HTML: Template module:
Go to the Perl Package Manager, run the command ppm, or click the Start menu -- ActivePerl 5.8.8 build 817 -- Perl Package Manager. Run the install command to install the HTML: Template module. The Code is as follows:
C: \> ppm
Ppm> install HTML-template
Ppm> quit
For specific parameters and usage, see the official jsdoc website.