Documentation Generator

deno doc followed by a list of one or more source files will print the JSDoc documentation for each of the module’s exported members.

For example, given a file add.ts with the contents:

  1. /**
  2. * Adds x and y.
  3. * @param {number} x
  4. * @param {number} y
  5. * @returns {number} Sum of x and y
  6. */
  7. export function add(x: number, y: number): number {
  8. return x + y;
  9. }

Running the Deno doc command, prints the function’s JSDoc comment to stdout:

  1. deno doc add.ts
  2. function add(x: number, y: number): number
  3. Adds x and y. @param {number} x @param {number} y @returns {number} Sum of x and y

Use the --json flag to output the documentation in JSON format. This JSON format is consumed by the deno doc website and is used to generate module documentation.