From 4720d452f8095703d1978700a1ea4f94eb3c1520 Mon Sep 17 00:00:00 2001 From: Terrance Kennedy Date: Sun, 17 Nov 2024 13:21:26 -0700 Subject: [PATCH] manualHTML: support --redirects option in nixos-render-docs --- doc/manual/default.nix | 6 ++++++ doc/manual/redirects.json | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 doc/manual/redirects.json diff --git a/doc/manual/default.nix b/doc/manual/default.nix index deada0a4..d8e12f29 100644 --- a/doc/manual/default.nix +++ b/doc/manual/default.nix @@ -79,11 +79,17 @@ in rec { '@DARWIN_OPTIONS_JSON@' \ ${optionsJSON}/share/doc/darwin/options.json + # Pass --redirects option if nixos-render-docs supports it + if nixos-render-docs manual html --help | grep --silent -E '^\s+--redirects\s'; then + redirects_opt="--redirects ${./redirects.json}" + fi + # TODO: --manpage-urls? nixos-render-docs -j $NIX_BUILD_CORES manual html \ --manpage-urls ${pkgs.writeText "manpage-urls.json" "{}"} \ --revision ${lib.escapeShellArg revision} \ --generator "nixos-render-docs ${lib.version}" \ + $redirects_opt \ --stylesheet style.css \ --stylesheet highlightjs/mono-blue.css \ --script ./highlightjs/highlight.pack.js \ diff --git a/doc/manual/redirects.json b/doc/manual/redirects.json new file mode 100644 index 00000000..46e6796c --- /dev/null +++ b/doc/manual/redirects.json @@ -0,0 +1,5 @@ +{ + "book-darwin-manual": [ + "index.html#book-darwin-manual" + ] +}