mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
accommodate inconsistent output from lowdown
the `term` output mode leaves inline HTML around verbatim, while `nroff` mode (used for `man` pages) does not. the correct solution would be to pre-render all output with a more benign tool so we have less liabilities in our own code, but this has to do for now.
This commit is contained in:
parent
8232711c9f
commit
e0e47c0a68
5 changed files with 25 additions and 17 deletions
|
@ -3,18 +3,21 @@ let
|
|||
inherit (import ./utils.nix) concatStrings indent optionalString squash;
|
||||
in
|
||||
|
||||
prefix: settingsInfo:
|
||||
# `inlineHTML` is a hack to accommodate inconsistent output from `lowdown`
|
||||
{ prefix, inlineHTML ? true }: settingsInfo:
|
||||
|
||||
let
|
||||
|
||||
showSetting = prefix: setting: { description, documentDefault, defaultValue, aliases, value, experimentalFeature }:
|
||||
let
|
||||
result = squash ''
|
||||
- <span id="${prefix}-${setting}">[`${setting}`](#${prefix}-${setting})</span>
|
||||
- ${item}
|
||||
|
||||
${indent " " body}
|
||||
'';
|
||||
|
||||
item = if inlineHTML
|
||||
then ''<span id="${prefix}-${setting}">[`${setting}`](#${prefix}-${setting})</span>''
|
||||
else "`${setting}`";
|
||||
# separate body to cleanly handle indentation
|
||||
body = ''
|
||||
${description}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue