Skip to content

Commit

Permalink
docs: rename generated manual to index.xhtml
Browse files Browse the repository at this point in the history
The `nixos-render-docs` tool outputs XHTML formatted content. In
order to convince browsers like `firefox` to treat the data as XHTML
the extension must be `.xhtml` and not `.html`.

Using the XHTML-formatted content as HTML is mainly an issue with
self-closing `<a />` tags.
  • Loading branch information
considerate committed Dec 7, 2023
1 parent 0a71046 commit 613dbb3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
12 changes: 9 additions & 3 deletions docs/home-manager-manual.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{ stdenv, lib, documentation-highlighter, nmd, revision, home-manager-options
, nixos-render-docs }:
{ stdenv
, lib
, documentation-highlighter
, nmd
, revision
, home-manager-options
, nixos-render-docs
}:
let outputPath = "share/doc/home-manager";
in stdenv.mkDerivation {
name = "home-manager-manual";
Expand Down Expand Up @@ -46,7 +52,7 @@ in stdenv.mkDerivation {
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
out/index.html
out/index.xhtml
'';

installPhase = ''
Expand Down
12 changes: 8 additions & 4 deletions docs/html-open-tool.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{ writeShellScriptBin, makeDesktopItem, symlinkJoin }:
{ html, pathName ? "home-manager", projectName ? pathName
, name ? "${pathName}-help" }:
{ html
, pathName ? "home-manager"
, projectName ? pathName
, name ? "${pathName}-help"
}:
let
helpScript = writeShellScriptBin name ''
set -euo pipefail
Expand All @@ -18,7 +21,7 @@ let
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.html"
exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
fi
'';

Expand All @@ -30,7 +33,8 @@ let
exec = "${helpScript}/bin/${name}";
categories = [ "System" ];
};
in symlinkJoin {
in
symlinkJoin {
inherit name;
paths = [ helpScript desktopItem ];
}
2 changes: 1 addition & 1 deletion tests/modules/misc/manual/manual.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
};

nmt.script = ''
assertFileExists home-path/share/doc/home-manager/index.html
assertFileExists home-path/share/doc/home-manager/index.xhtml
assertFileExists home-path/share/doc/home-manager/options.html
assertFileExists home-path/share/doc/home-manager/options.json
assertFileExists home-path/share/man/man1/home-manager.1
Expand Down

0 comments on commit 613dbb3

Please sign in to comment.