Skip to content
RupaliM edited this page Oct 3, 2018 · 2 revisions

Documenting JavaScript with Jsdoc

  1. Install NPM /Node.js which comes with npm.
  2. Install JsDoc by typing the following command (npm install -g jsdoc.)
  3. Comment your code according to your need and refer js.documentation.
  4. Go to destination folder cd (your path) src folder
  5. Run Js-Doc / generate documentation. jsdoc -d ../doc js/

JSDoc supports two different kinds of tags:

Block tags, which are at the top level of a JSDoc comment. Inline tags, which are within the text of a block tag or a description.

1.Block and inline tags in JSDoc comments /** * Set the shoe's color. Use {@link Shoe#setSize} to set the shoe size. * * @param {string} color - The shoe's color. */

  1. Inline tag used within a block tag /** * Set the shoe's color. * * @param {SHOE_COLORS} color - The shoe color. Must be an enumerated * value of {@link SHOE_COLORS}. */
  2. Multiple block tags separated by line breaks /** * Set the color and type of the shoelaces. * * @param {LACE_COLORS} color - The shoelace color. * @param {LACE_TYPES} type - The type of shoelace. */
Clone this wiki locally