Commit graph

41 commits

Author SHA1 Message Date
Valentin Gagarin e0e47c0a68 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.
2023-10-05 01:20:26 +02:00
Valentin Gagarin 64b73476ce always show anchors on setting listings
refactor the templates for readability
2023-10-05 00:05:08 +02:00
John Ericson 4606a07bb6
generate-manpage.nix: Add comment explaining one bit 2023-09-25 08:20:39 -04:00
John Ericson 9f93972c4d manual / manpages: Make option category names a proper subheader
Before they were an "ad-hoc" header with bold and a colon; now they are
a proper subheader.

For the man pages, this doesn't make much of a difference, but it will
help more on for the HTML manual, where things can be restyled. Again,
good separation of content vs presentation.
2023-09-23 00:37:44 -04:00
John Ericson 1d9fd3a6f8 manual / manpages: Adjust option filter filtering, move from C++ to Nix
Behavior change:

Before we only showed uption if the command-specific options were
non-empty. But that is somewhat odd since we also show common options.
Now, we do everything based on the union of both sorts of options (with
hidden-categories filtered, as before).

Implementation change:

The JSON dumping once again includes all options; the filtering of
hidden categories is done in the Nix instead. This is better separation
of "content" vs "presentation", and prepare the way for the HTML manual
vs manpages / `--help` doing different things.
2023-09-23 00:34:51 -04:00
John Ericson 9c640c1229 doc: showOptions: Simplify code with builtins.groupBy
This makes grouping options by category much nicer. No behavior should
be changed.
2023-09-23 00:28:16 -04:00
John Ericson 694810ba34 doc: showOptions: Move union to caller
`showOptions` itself doesn't care, so it shouldn't take two separate
arguments.
2023-09-22 23:54:04 -04:00
Valentin Gagarin 09eb7f1ef6 do not show configuration override flags for each command
this removes a lot of noise from the web search, which precludes finding
the actual documentation.

some configuration settings have enough documentation to warrant
individual pages, so the alternative of including full setting
documentation in each command page doesn't make much sense here.

this change technically means that the command line flags to override
settings are "invisible", and not exported as JSON. this may or may not
be desirable. a more explicit approach would be adding a `hidden` field
to the flag's JSON output, but would also require adjusting
post-processing of that JSON for manual rendering.
2023-09-07 02:02:27 +02:00
Valentin Gagarin b0fe7f560d add missing link 2023-09-07 01:38:53 +02:00
Valentin Gagarin 589fd897fb add todo on store docs 2023-09-07 01:38:53 +02:00
Valentin Gagarin 391f18063c add anchors to option listings 2023-09-06 09:52:56 +02:00
John Ericson 3b592c880a Add infra for experimental store implemenations
This is analogous to that for experimental settings and flags that we
have also added as of late.
2023-08-02 15:46:38 -04:00
Valentin Gagarin 5d78dc4176
doc rendering: add functions to scope explicitly (#7378)
* doc rendering: add functions to scope explicitly

this especially helps beginners with code readability, since the origin
of names is always immediately visible.
2023-05-03 07:16:29 +00:00
John Ericson ba9ae691b6 Add optionalString to manual Nix lang utilities
Use it everywhere it could be also.
2023-04-16 10:57:46 -04:00
John Ericson d93e76fbb8 Start cross-referencing experimental features
- Create a glossary entry for experimental features.

- Have the man page experimental feature notice link `nix-commmand`.

  (Eventually this should be programmed, based on whether the command is
  experimental, and if so what experimental feature does it depend on.)

- Document which installables depend on which experimental features.

  I tried to use the same style (bold warning and block quote) that the
  top of the man page uses.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-04-14 07:45:08 -04:00
Eelco Dolstra 2851e239a7 Make useAnchors a named argument 2023-03-23 10:08:49 +01:00
Eelco Dolstra 9eb53bbf17 Support per-store Markdown documentation 2023-03-21 14:03:40 +01:00
Eelco Dolstra 8d6d59cb1b nix store --help: Include store type documentation 2023-03-21 14:03:40 +01:00
Eelco Dolstra 6f62cb3611 generate-manpage.nix: Make more readable 2023-03-21 12:11:32 +01:00
Valentin Gagarin 3f881e3378
add missing newline, for consistent formatting 2022-11-30 23:40:53 +01:00
Ana Hobden 069409d167 Print common flags in --help 2022-10-07 09:07:22 -07:00
Valentin Gagarin d8bef7358f bring back lost newline 2022-09-30 01:43:57 +02:00
Valentin Gagarin 70eea97742 use more self-explanatory names 2022-09-30 01:43:57 +02:00
Valentin Gagarin 61188cb820 move final template to the top
this allows readers to enter the code starting with what is visible from
the outside, instead of working themselves up from purely technical details.
2022-09-30 01:43:57 +02:00
Valentin Gagarin 0e0f1832de remove superfluous let-in pair 2022-09-30 01:43:57 +02:00
Valentin Gagarin a85df04fcb refactor showOptions
it was quite a pain to manipulate strings just with `builtins`
2022-09-30 01:43:53 +02:00
Valentin Gagarin 4655563470 refactor rendering command documentation to markdown
idea:
- make document structure visible, like in a template
- order functions by descending abstraction
- avoid nested let bindings
2022-09-30 01:42:46 +02:00
Valentin Gagarin 6b56bb4a79 use indented strings where appropriate 2022-09-30 01:42:46 +02:00
Valentin Gagarin e7dcacbd7c do not render relative links in help pages
this simplifies the setup a lot, and avoids weird looking `./file.md`
links showing up.

it also does not show regular URLs any more. currently the command
reference only has few of them, and not showing them in the offline
documentation is hopefully not a big deal.

instead of building more special-case solutions, clumsily preprocessing
the input, or issuing verbal rules on dealing with URLs, should better
be solved sustainably by not rendering relative links in `lowdown`:

https://github.com/kristapsdz/lowdown/issues/105
2022-08-26 17:10:41 +02:00
Eelco Dolstra 08aa7daee0 Remove links to .md files in help output
Fixes #5337.
2021-10-06 13:01:18 +02:00
Eelco Dolstra 49a932fb18 nix --help: Display help using lowdown instead of man
Fixes #4476.
Fixes #5231.
2021-09-13 14:45:21 +02:00
Eelco Dolstra 6042febfce Restore warning about 'nix' being experimental
Fixes #4552.
2021-02-17 15:30:49 +01:00
Eelco Dolstra 36c4d6f592 Group common options 2021-01-25 19:03:13 +01:00
Eelco Dolstra 807d963ee8 Group subcommands by category 2021-01-25 18:19:32 +01:00
Eelco Dolstra 1047cb1e53
Command: Remove examples() 2020-12-23 18:26:40 +01:00
Eelco Dolstra 9dcd0aebc5
generate-manpage.nix: Fix short names 2020-12-21 13:32:27 +01:00
Eelco Dolstra c3c858ac6d Make doc() return arbitrary Markdown rather than the contents of the "Description" section
Thus we can return the examples section (and any other sections) from
doc() and don't need examples() anymore.
2020-12-03 16:17:58 +01:00
Eelco Dolstra e2efc63979 Put examples first in the manpages 2020-12-02 23:23:23 +01:00
Eelco Dolstra 72428e38d9 Generate separate manpages for each nix subcommand 2020-12-02 23:23:23 +01:00
Eelco Dolstra 58dadf2954 Remove stray 'Title:' from the manual
Closes #4096.
2020-10-08 17:30:40 +02:00
Eelco Dolstra 39bc49318f jq -> nix 2020-09-16 14:58:06 +02:00