Unverified Commit 131f480c authored by Silvan Mosberger's avatar Silvan Mosberger Committed by GitHub
Browse files

doc/README: More anchors to link to (#347808)

parents 4216d3cd 3a26957d
Loading
Loading
Loading
Loading
+96 −84
Original line number Diff line number Diff line
@@ -176,13 +176,19 @@ When needed, each convention explain why it exists, so you can make a decision w
Note that these conventions are about the **structure** of the manual (and its source files), not about the content that goes in it.
You, as the writer of documentation, are still in charge of its content.

- Put each sentence in its own line.
### One sentence per line

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.

- Use the [admonition syntax](#admonitions) for callouts and examples.
### Callouts and examples

Use the [admonition syntax](#admonitions) for callouts and examples.

### Provide self-contained examples

- Provide at least one example per function, and make examples self-contained.
Provide at least one example per function, and make examples self-contained.
This is easier to understand for beginners.
It also helps with testing that it actually works – especially once we introduce automation.

@@ -206,7 +212,9 @@ You, as the writer of documentation, are still in charge of its content.
}
```

- When showing inputs/outputs of any [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), such as a shell or the Nix REPL, use a format as you'd see in the REPL, while trying to visually separate inputs from outputs.
### REPLs

When showing inputs/outputs of any [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), such as a shell or the Nix REPL, use a format as you'd see in the REPL, while trying to visually separate inputs from outputs.
This means that for a shell, you should use a format like the following:
```shell
$ nix-build -A hello '<nixpkgs>' \
@@ -224,7 +232,9 @@ You, as the writer of documentation, are still in charge of its content.
```
Note how the input is preceded by `nix-repl>` and the output is provided as you'd see on the Nix REPL.

- When documenting functions or anything that has inputs/outputs and example usage, use nested headings to clearly separate inputs, outputs, and examples.
### Headings for inputs, outputs and examples

When documenting functions or anything that has inputs/outputs and example usage, use nested headings to clearly separate inputs, outputs, and examples.
Keep examples as the last nested heading, and link to the examples wherever applicable in the documentation.

The purpose of this convention is to provide a familiar structure for navigating the manual, so any reader can expect to find content related to inputs in an "inputs" heading, examples in an "examples" heading, and so on.
@@ -257,7 +267,9 @@ You, as the writer of documentation, are still in charge of its content.
:::
```

- Use [definition lists](#definition-lists) to document function arguments, and the attributes of such arguments as well as their [types](https://nixos.org/manual/nix/stable/language/values).
### Function arguments

Use [definition lists](#definition-lists) to document function arguments, and the attributes of such arguments as well as their [types](https://nixos.org/manual/nix/stable/language/values).
For example:

```markdown