node/tools/doc
Antoine du HAMEL 21abb2545f doc: move module core module doc to separate page
The `module` core module is available for both CJS and ESM users, it
deserves its own page.

PR-URL: https://github.com/nodejs/node/pull/34747
Refs: https://github.com/nodejs/modules/issues/539
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-08-19 10:44:06 -07:00
..
addon-verify.js tools: refactor tools JS code 2019-03-04 11:06:23 -08:00
allhtml.js doc,tools: syntax highlight api docs at compile-time 2020-07-16 00:22:35 +02:00
alljson.js tools: build all.json by combining generated JSON 2018-07-09 22:57:33 +03:00
apilinks.js tools: switch to camelcasing in apilinks.js 2019-05-09 21:41:03 -07:00
checkLinks.js doc,tools: annotate broken links in actions workflow 2020-08-19 10:42:36 -07:00
common.js doc: add dynamic source code links 2020-06-26 10:25:14 -07:00
generate.js doc: add dynamic source code links 2020-06-26 10:25:14 -07:00
html.js doc,tools: syntax highlight api docs at compile-time 2020-07-16 00:22:35 +02:00
json.js doc: use _Static method_ instead of _Class Method_ 2020-08-09 07:02:28 -07:00
LICENSE Mention marked, and add license to doc generator 2012-03-05 10:59:14 -08:00
links-mapper.json tools: add unified plugin changing links for html docs 2019-11-30 18:17:56 +01:00
markdown.js tools: add unified plugin changing links for html docs 2019-11-30 18:17:56 +01:00
package-lock.json doc,tools: syntax highlight api docs at compile-time 2020-07-16 00:22:35 +02:00
package.json doc,tools: syntax highlight api docs at compile-time 2020-07-16 00:22:35 +02:00
README.md doc: normalize Markdown code block info strings 2020-05-30 04:27:31 +02:00
type-parser.js doc: move module core module doc to separate page 2020-08-19 10:44:06 -07: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).