0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/tools/doc/README.md

110 lines
2.1 KiB
Markdown
Raw Normal View History

2012-02-27 19:59:01 +01:00
Here's how the node docs work.
1:1 relationship from `lib/<module>.js` to `doc/api/<module>.md`.
2012-02-27 19:59:01 +01:00
Each type of heading has a description block.
```md
# module
<!--introduced_in=v0.10.0-->
2012-02-27 19:59:01 +01:00
> Stability: 2 - Stable
2012-02-27 19:59:01 +01:00
A description and examples.
2012-02-27 19:59:01 +01:00
## module.property
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* {type}
2012-02-27 19:59:01 +01:00
A description of the property.
2012-02-27 19:59:01 +01:00
## module.someFunction(x, y, [z=100])
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* `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`.
2012-02-27 19:59:01 +01:00
A description of the function.
2012-02-27 19:59:01 +01:00
## module.someNewFunction(x)
<!-- YAML
added: REPLACEME
-->
2012-02-27 19:59:01 +01:00
* `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.
2012-02-27 19:59:01 +01:00
Modules don't usually raise events on themselves. `cluster` is the
only exception.
2012-02-27 19:59:01 +01:00
## Class: SomeClass
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
A description of the class.
2012-02-27 19:59:01 +01:00
### SomeClass.classMethod(anArg)
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* `anArg` {Object} Just an argument.
* `field` {string} `anArg` can have this field.
* `field2` {boolean} Another field. **Default:** `false`.
* Returns: {boolean} `true` if it worked.
2012-02-27 19:59:01 +01:00
A description of the method for humans.
2012-02-27 19:59:01 +01:00
### SomeClass.nextSibling()
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* Returns: {SomeClass | null} The next `SomeClass` in line.
2012-02-27 19:59:01 +01:00
`SomeClass` must be registered in `tools/doc/type-parser.js`
to be properly parsed in `{type}` fields.
### SomeClass.someProperty
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* {string}
2012-02-27 19:59:01 +01:00
The indication of what `someProperty` is.
2012-02-27 19:59:01 +01:00
### Event: 'grelb'
<!-- YAML
added: v0.10.0
-->
2012-02-27 19:59:01 +01:00
* `isBlerg` {boolean}
2012-02-27 19:59:01 +01:00
This event is emitted on instances of `SomeClass`, not on the module itself.
```
2012-02-27 19:59:01 +01:00
* 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).