1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

deno doc docs (#5650)

This commit is contained in:
Matt Dumler 2020-06-04 14:12:02 -05:00 committed by GitHub
parent 4b1638dccc
commit a04166e9fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,33 @@
## Documentation Generator
<!-- TODO(lucacasonto): write things -->
`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 <declaration>` 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.