diff --git a/doc/manual/anchors.jq b/doc/manual/anchors.jq index 4ee2bc130..8a48017c1 100755 --- a/doc/manual/anchors.jq +++ b/doc/manual/anchors.jq @@ -24,8 +24,15 @@ def map_contents_recursively(transformer): def process_command: .[0] as $context | .[1] as $body | - $body + { - sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)), - }; + # mdbook 0.5.x uses 'items' instead of 'sections' + if $body.items then + $body + { + items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)), + } + else + $body + { + sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)), + } + end; process_command diff --git a/doc/manual/book.toml.in b/doc/manual/book.toml.in index bacca59ff..c798afc4a 100644 --- a/doc/manual/book.toml.in +++ b/doc/manual/book.toml.in @@ -24,12 +24,3 @@ renderers = ["html"] command = "jq --from-file ./anchors.jq" [output.markdown] - -[output.linkcheck] -# no Internet during the build (in the sandbox) -follow-web-links = false - -# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in -# excessive "Potential incomplete link" warnings. No other kind of warning was -# produced at the time of writing. -warning-policy = "ignore" diff --git a/doc/manual/package.nix b/doc/manual/package.nix index 1d7d73ce9..020db3408 100644 --- a/doc/manual/package.nix +++ b/doc/manual/package.nix @@ -6,7 +6,6 @@ ninja, lowdown-unsandboxed, mdbook, - mdbook-linkcheck, jq, python3, rsync, @@ -67,7 +66,6 @@ mkMesonDerivation (finalAttrs: { ninja (lib.getBin lowdown-unsandboxed) mdbook - mdbook-linkcheck jq python3 rsync diff --git a/doc/manual/substitute.py b/doc/manual/substitute.py index 6e27c3388..106dcf17d 100644 --- a/doc/manual/substitute.py +++ b/doc/manual/substitute.py @@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path return data | dict( sections = [recursive_replace(section, book_root, search_path) for section in sections], ) + case {'items': items}: + return data | dict( + items = [recursive_replace(item, book_root, search_path) for item in items], + ) case {'Chapter': chapter}: path_to_chapter = Path(chapter['path']) chapter_content = chapter['content']