aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/book.toml
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-04-02 17:01:53 -0600
committerQyriad <qyriad@qyriad.me>2024-04-04 21:43:19 +0000
commitc355354772df290bac1dc71725052ac7f89617b9 (patch)
treec03774b95e07a809932c71bdd0f1038842a0a98a /doc/manual/book.toml
parent9166babbaf5882ad2cfe1c7c9b30de1c153d70a8 (diff)
docs: replace sed invocation with an mdbook preprocessor for @docroot@
We're not entirely clear on why the links preprocessor has to be done *before* rather than after, but we assume it is probably that as a builtin preprocessor it does some processing on the raw book source, and not just the JSON data. Also a real use for Python pattern matching? I know I was surprised too. Change-Id: Ibe8b59e7b5bd5f357a655d8b4c5f0b0f58a67d6b
Diffstat (limited to 'doc/manual/book.toml')
-rw-r--r--doc/manual/book.toml9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/manual/book.toml b/doc/manual/book.toml
index 73fb7e75e..1d14347a4 100644
--- a/doc/manual/book.toml
+++ b/doc/manual/book.toml
@@ -7,6 +7,15 @@ additional-js = ["redirects.js"]
edit-url-template = "https://github.com/NixOS/nix/tree/master/doc/manual/{path}"
git-repository-url = "https://github.com/NixOS/nix"
+# Handles replacing @docroot@ with a path to ./src relative to that markdown file.
+[preprocessor.docroot]
+renderers = ["html", "linkcheck"]
+command = "python3 doc/manual/docroot.py"
+# I would have thought that @docroot@ replacement had to be done *before*
+# the link preprocessor gets its hands on this book, but nope it's actually
+# the opposite.
+after = ["links"]
+
[preprocessor.anchors]
renderers = ["html"]
command = "jq --from-file doc/manual/anchors.jq"