Automatic library¶
Tip
Click the [source] link next to the object
to open the declaration source file.
Click the eye icon in the upper-right of the page to open the Markdown source file.
Document a function library¶
To document a whole set of functions,
use the nix:autolibrary directive.
Document everything¶
To document every function found, don’t pass any argument to the directive.
For example:
```{default-domain} nix
```
```{autolibrary}
```
Renders:
- exampleLib.myFunc[source]¶
Compute the addition of
aandb.
- Type:
a :: int -> b :: int -> int- Parameters:
a (int) – the first number to add
b (int) – the second number to add
- Returns:
aandbadded togetherExample usage:
lib.myFunc 2 2 # => 4
- exampleLib.myOtherFunc[source]¶
Same as
myFunc, but withaandbgiven as an attribute set.
- Type:
{ a :: int; b :: int; } -> int- Parameters:
a (int) – the first number to add
b (int) – the second number to add
- Returns:
aandbadded together
- exampleLib.scope.myScopedFunc[source]¶
This function is inside a scope!
The documentation can refer to other function in the same scope, it will be resolved, local first, e.g.
myOtherFunc.It can also refer to functions from the parent scope, e.g.
myFunc.
Document a subset¶
To render only a subset of function, pass the desired scope to the directive.
For example:
```{default-domain} nix
```
```{autolibrary} exampleLib.scope
```
Renders:
- exampleLib.scope.myScopedFunc[source]¶
This function is inside a scope!
The documentation can refer to other function in the same scope, it will be resolved, local first, e.g.
myOtherFunc.It can also refer to functions from the parent scope, e.g.
myFunc.
Document a single function¶
To document a single function,
use the nix:autofunction directive.
For example:
```{default-domain} nix
```
```{autofunction} exampleLib.myFunc
```
Renders: