From a04166e9fa87450dfa910afeaf0c1dad988f3988 Mon Sep 17 00:00:00 2001 From: Matt Dumler Date: Thu, 4 Jun 2020 14:12:02 -0500 Subject: [PATCH] deno doc docs (#5650) --- docs/tools/documentation_generator.md | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/tools/documentation_generator.md b/docs/tools/documentation_generator.md index 07b0b5c953..661fa22e5d 100644 --- a/docs/tools/documentation_generator.md +++ b/docs/tools/documentation_generator.md @@ -1,3 +1,33 @@ ## 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. Currently, only +exports in the style `export ` and `export ... from ...` are are +supported. + +For example, given a file `add.ts` with the contents: + +```ts +/** + * Adds x and y. + * @param {number} x + * @param {number} y + * @returns {number} Sum of x and y + */ +export function add(x: number, y: number): number { + return x + y; +} +``` + +Running the Deno `doc` command, prints the function's JSDoc comment to `stdout`: + +```shell +deno doc add.ts +function add(x: number, y: number): number + 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](https://github.com/denoland/doc_website) and used to generate +module documentation.