Documentation Tool - Durjoy01/Cholo_jai GitHub Wiki

Documentation tool:

We will be using "JSDoc" as documentation tool for our project. We have chosen JSDoc for following reasons:

  1. Better Code Readability: JSDoc provides a consistent way to explain what each function does, making your code easier to understand.
  2. IDE Integration: Many modern IDEs support JSDoc, so they can show tooltips and type hints based on the JSDoc comments, aiding development and reducing bugs.
  3. Auto-generated Docs: Generate a full HTML documentation site without manually writing documentation files.

Getting started:

1) Installing JSDoc:

Can be installed globally or as dev dependency. Using the command "npm install -g jsdoc" for global and "npm install --save-dev jsdoc" for dev dependency.

2) Adding JSDoc comments to the code:

JSDoc comments stays above the actual code that we want to document, whether functions, classes, or variables. They start with /** and typically include annotations like @param, @returns, and @example. For example: Screenshot 2024-10-28 142631

Here we are documenting a function.

3)Running JSDoc to generate documentation:

Using the command "npx jsdoc yourFile.js -d docs", we will get formatted documentation in a html file. Replacing yourfile.js with our example.js and ruuning the command, we got this: Screenshot 2024-10-28 143458