Getting Started with JSDoc 3
Table of Contents
Adding documentation comments to your code
JSDoc comments should generally be placed immediately before the code being documented. Each comment must start with a
/** sequence in order to
be recognized by the JSDoc parser. Comments beginning with
/***, or more than 3 stars will be ignored. This is a feature to allow
you to suppress parsing of comment blocks.
Adding a description is simple—just type the description you want in the documentation comment.
Special "JSDoc tags" can be used to give more information. For example, if the function is a constructor for a class, you can indicate this by adding
More tags can be used to add more information. See the home page for a complete list of tags that are recognized by JSDoc 3.
Generating a website
Once your code is commented, you can use the JSDoc 3 tool to generate an HTML website from your source files.
By default, JSDoc uses the built-in "default" template to turn the documentation into HTML. You can edit this template to suit your own needs or create an entirely new template if that is what you prefer.
This command will create a directory named
out/ in the current working directory. Within that directory, you will find the generated HTML pages.