Skip to content

Commit 2636f50

Browse files
committed
maint: Remove mdbook-linkcheck and support mdbook 0.5.x
Fixes #14628 - Remove mdbook-linkcheck dependency and configuration (was blocking upgrades to mdbook 0.5.0+, configured with warning-policy = "ignore" due to false positives, and redundant with lychee-based link checking) - Update substitute.py and anchors.jq to handle 'items' (mdbook 0.5.x) in addition to 'sections' (mdbook 0.4.x), as per mdbook 0.5.0 changelog: "Book::sections was renamed to Book::items" https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#05-migration-guide
1 parent d261557 commit 2636f50

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

doc/manual/anchors.jq

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
2424
def process_command:
2525
.[0] as $context |
2626
.[1] as $body |
27-
$body + {
28-
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
29-
};
27+
# mdbook 0.5.x uses 'items' instead of 'sections'
28+
if $body.items then
29+
$body + {
30+
items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
31+
}
32+
else
33+
$body + {
34+
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
35+
}
36+
end;
3037

3138
process_command

doc/manual/book.toml.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,3 @@ renderers = ["html"]
2424
command = "jq --from-file ./anchors.jq"
2525

2626
[output.markdown]
27-
28-
[output.linkcheck]
29-
# no Internet during the build (in the sandbox)
30-
follow-web-links = false
31-
32-
# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
33-
# excessive "Potential incomplete link" warnings. No other kind of warning was
34-
# produced at the time of writing.
35-
warning-policy = "ignore"

doc/manual/package.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
ninja,
77
lowdown-unsandboxed,
88
mdbook,
9-
mdbook-linkcheck,
109
jq,
1110
python3,
1211
rsync,
@@ -67,7 +66,6 @@ mkMesonDerivation (finalAttrs: {
6766
ninja
6867
(lib.getBin lowdown-unsandboxed)
6968
mdbook
70-
mdbook-linkcheck
7169
jq
7270
python3
7371
rsync

doc/manual/substitute.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path
4141
return data | dict(
4242
sections = [recursive_replace(section, book_root, search_path) for section in sections],
4343
)
44+
case {'items': items}:
45+
return data | dict(
46+
items = [recursive_replace(item, book_root, search_path) for item in items],
47+
)
4448
case {'Chapter': chapter}:
4549
path_to_chapter = Path(chapter['path'])
4650
chapter_content = chapter['content']

0 commit comments

Comments
 (0)