node/tools/doc
Antoine du Hamel e8b1ea4ee2
tools,doc: add "legacy" badge in the TOC
PR-URL: https://github.com/nodejs/node/pull/37949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-01 12:31:25 -07:00
..
addon-verify.js tools: update doc tools to remark-parse@9.0.0 2020-11-12 06:29:51 +00:00
allhtml.js doc: optimize HTML rendering 2021-02-15 16:14:15 +01:00
alljson.js tools,doc: list the stability status of each API 2021-01-20 01:23:45 +01:00
apilinks.js tools,doc: enable ecmaVersion 2021 in acorn parser 2020-11-07 01:30:21 +00:00
checkLinks.js tools: update doc tools to remark-parse@9.0.0 2020-11-12 06:29:51 +00:00
common.js tools: update doc tool dependencies 2021-01-11 08:13:23 +01:00
generate.js tools: update doc tools to remark-parse@9.0.0 2020-11-12 06:29:51 +00:00
html.js tools,doc: add "legacy" badge in the TOC 2021-04-01 12:31:25 -07:00
json.js doc: use sentence case for class property 2020-10-09 06:10:16 -07:00
LICENSE
links-mapper.json tools: add unified plugin changing links for html docs 2019-11-30 18:17:56 +01:00
markdown.js doc: use .md extension for internal links 2020-10-01 06:19:12 -07:00
package-lock.json tools: avoid pending deprecation in doc generator 2021-02-12 21:46:54 +01:00
package.json tools: avoid pending deprecation in doc generator 2021-02-12 21:46:54 +01:00
README.md doc: normalize Markdown code block info strings 2020-05-30 04:27:31 +02:00
stability.js tools: remove commented code from stability.js 2021-01-29 20:05:25 +08:00
type-parser.js lib: aggregate errors to avoid error swallowing 2021-03-19 12:43:03 +01:00
versions.js tools: only fetch previous versions when necessary 2020-03-31 18:25:10 -04:00

Here's how the node docs work.

1:1 relationship from lib/<module>.js to doc/api/<module>.md.

Each type of heading has a description block.

# module

<!--introduced_in=v0.10.0-->

> Stability: 2 - Stable

A description and examples.

## module.property
<!-- YAML
added: v0.10.0
-->

* {type}

A description of the property.

## module.someFunction(x, y, [z=100])
<!-- YAML
added: v0.10.0
-->

* `x` {string} The description of the string.
* `y` {boolean} Should I stay or should I go?
* `z` {number} How many zebras to bring. **Default:** `100`.

A description of the function.

## module.someNewFunction(x)
<!-- YAML
added: REPLACEME
-->

* `x` {string} The description of the string.

This feature is not in a release yet.

## Event: 'blerg'
<!-- YAML
added: v0.10.0
-->

* `anArg` {type} A description of the listener argument.

Modules don't usually raise events on themselves. `cluster` is the
only exception.

## Class: SomeClass
<!-- YAML
added: v0.10.0
-->

A description of the class.

### SomeClass.classMethod(anArg)
<!-- YAML
added: v0.10.0
-->

* `anArg` {Object} Just an argument.
  * `field` {string} `anArg` can have this field.
  * `field2` {boolean} Another field. **Default:** `false`.
* Returns: {boolean} `true` if it worked.

A description of the method for humans.

### SomeClass.nextSibling()
<!-- YAML
added: v0.10.0
-->

* Returns: {SomeClass | null} The next `SomeClass` in line.

`SomeClass` must be registered in `tools/doc/type-parser.js`
to be properly parsed in `{type}` fields.

### SomeClass.someProperty
<!-- YAML
added: v0.10.0
-->

* {string}

The indication of what `someProperty` is.

### Event: 'grelb'
<!-- YAML
added: v0.10.0
-->

* `isBlerg` {boolean}

This event is emitted on instances of `SomeClass`, not on the module itself.
  • Classes have (description, Properties, Methods, Events).
  • Events have (list of listener arguments, description).
  • Functions have (list of arguments, returned value if defined, description).
  • Methods have (list of arguments, returned value if defined, description).
  • Modules have (description, Properties, Functions, Classes, Examples).
  • Properties have (type, description).