2020-05-06 18:21:13 -04:00
|
|
|
## Documentation Generator
|
|
|
|
|
2020-06-04 15:12:02 -04:00
|
|
|
`deno doc` followed by a list of one or more source files will print the JSDoc
|
2020-09-13 09:17:25 -04:00
|
|
|
documentation for each of the module's **exported** members.
|
2020-06-04 15:12:02 -04:00
|
|
|
|
|
|
|
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
|
2020-09-13 09:17:25 -04:00
|
|
|
[deno doc website](https://github.com/denoland/doc_website) and is used to
|
|
|
|
generate module documentation.
|