docs: add clarifying explanation about reference documentation

apply @roberth suggestion

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
Johannes Kirschbauer
2025-09-12 20:55:32 +02:00
parent cf0760e7be
commit 0862b93066
+28
View File
@@ -213,6 +213,34 @@ Put each sentence in its own line.
This makes reviews and suggestions much easier, since GitHub's review system is based on lines.
It also helps identifying long sentences at a glance.
### Writing Function Documentation
Function documentation is *reference documentation*, for which
[diataxis Reference documentation](https://diataxis.fr/reference/) (8 minutes) is **mandatory reading**.
On top of the diataxis framework, which provides a balanced perspective on what reference documentation should contain, we apply a specific style rule to function documentation:
the first sentence is in present tense, active voice, and the subject is omitted, referring implicitly to the name of the function.
For example:
```nix
/**
Subtracts value `b` from value `a`.
Returns the difference as a number.
*/
subtractValues # ...elided code
```
Renders as:
```md
## `subtractValues`
Subtracts value `b` from value `a`.
Returns the difference as a number.
```
### Callouts and examples
Use the [admonition syntax](#admonitions) for callouts and examples.