mirror of
https://github.com/NixOS/nix.git
synced 2025-12-02 23:20:59 +01:00
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
(cherry picked from commit 2636f50dd4)
This commit is contained in:
parent
0f4073f9d7
commit
6ac33ab878
4 changed files with 14 additions and 14 deletions
|
|
@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
|
|||
def process_command:
|
||||
.[0] as $context |
|
||||
.[1] as $body |
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -23,12 +23,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"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
ninja,
|
||||
lowdown-unsandboxed,
|
||||
mdbook,
|
||||
mdbook-linkcheck,
|
||||
jq,
|
||||
python3,
|
||||
rsync,
|
||||
|
|
@ -51,7 +50,6 @@ mkMesonDerivation (finalAttrs: {
|
|||
ninja
|
||||
(lib.getBin lowdown-unsandboxed)
|
||||
mdbook
|
||||
mdbook-linkcheck
|
||||
jq
|
||||
python3
|
||||
rsync
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue