aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane@hufschmitt.net>2022-04-05 13:34:25 +0200
committerThéophane Hufschmitt <theophane@hufschmitt.net>2022-04-05 13:50:42 +0200
commit660c19eb492d834c238bcdde02ba0a7e3c4f0c40 (patch)
tree9bf7a3d319a46f81c1cbe0520c7ad54d90f7825e /doc
parentec90fc4d1f42db3c5e3c74dc186487d10a28c221 (diff)
manual: Add some anchor targets for the nix.conf options
For each `nix.conf` option, add an empty html node with a unique `id` that can be used as an anchor target. Also make the name of the option be a link to that target so that it’s easily discoverable. We can’t rewrite the whole list as an html definition list like it’s done for the builtins because these options also appear in a man page, and the manpage renderer (lowdown) can’t render arbitrary html. But the hack here allows to keep the manpage and have the links in the html version. Fix https://github.com/NixOS/nix/issues/5745
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/generate-options.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/manual/generate-options.nix b/doc/manual/generate-options.nix
index 84d90beb6..2d586fa1b 100644
--- a/doc/manual/generate-options.nix
+++ b/doc/manual/generate-options.nix
@@ -6,7 +6,8 @@ options:
concatStrings (map
(name:
let option = options.${name}; in
- " - `${name}` \n\n"
+ " - [`${name}`](#conf-${name})"
+ + "<p id=\"conf-${name}\"></p>\n\n"
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
+ (if option.documentDefault
then " **Default:** " + (