tvl-depot/users/sterni/htmlman
sterni b3f686995f feat(users/sterni/htmlman): hyperlink .Xr macro in output
We make use of the -O man=… option of mandoc(1) which allows to convert
cross references via the .Xr macro into actual hyperlinks in the output.
This can be disabled (by passing "none") or done in two modes:

* all: links all .Xr cross references as if they were in
  $out/%N.%S.html. This will lead to broken links of course.
* inManDir: only link to files in $out if the man page is found in
  manDir, use the template defined in linkXrFallback if not.

all is the default, since we don't require all man pages to be in
manDir, so it would be potentially confusing if the path attribute was
used in the pages list.

linkXrFallback uses the debian online man viewer by default currently,
since it can be decently hyperlinked and debian has a lot of packages.
Other options would be:

* https://manpages.ubuntu.com/manpages/latest/en/man%S/%N.%S.html
* https://man.archlinux.org/man/%N.%S.en
* https://man.openbsd.org/%N.%S
* https://www.man7.org/linux/man-pages/man%S/%N.%S.html

Change-Id: I1363b9dfdda25cb7383c7310b8115c335444bd3d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2597
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-03-11 14:31:19 +00:00
..
default.nix feat(users/sterni/htmlman): hyperlink .Xr macro in output 2021-03-11 14:31:19 +00:00
defaultStyle.nix feat(users/sterni/htmlman): static site generator for manual pages 2021-03-11 13:12:31 +00:00
README.md feat(users/sterni/htmlman): static site generator for manual pages 2021-03-11 13:12:31 +00:00

htmlman

static site generator for man pages intended for rendering man page documentation viewable using a web browser.

usage

If you have a nix expression, doc.nix, like this:

{ depot, ... }:

depot.users.sterni.htmlman {
  title = "foo project";
  pages = [
    {
      name = "foo";
      section = 1;
    }
    {
      name = "foo";
      section = 3;
      path = ../devman/foo.3;
    }
  ];
  manDir = ../man;
}

You can run the following to directly deploy the resulting documentation output to a specific target directory:

nix-build -A deploy doc.nix && ./result target_directory