From f8dc368fe369b7b492ce38953ba107ac35d9f7e2 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 18 Aug 2025 14:21:36 -0700 Subject: [PATCH] Switch to using native mdbook fragment redirects Mdbook recently gained the ability to redirect fragments. This removes the embedded scripts to use this mechanism instead. --- .github/workflows/contrib.yml | 2 +- .github/workflows/main.yml | 2 +- src/doc/book.toml | 54 ++++++++++++++++++- src/doc/src/reference/manifest.md | 43 --------------- src/doc/src/reference/registries.md | 26 --------- src/doc/src/reference/resolver.md | 16 ------ .../src/reference/specifying-dependencies.md | 19 ------- src/doc/src/reference/workspaces.md | 14 ----- 8 files changed, 55 insertions(+), 121 deletions(-) diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml index 02dd4396a..15f6e761b 100644 --- a/.github/workflows/contrib.yml +++ b/.github/workflows/contrib.yml @@ -23,7 +23,7 @@ jobs: - name: Install mdbook run: | mkdir mdbook - curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.44/mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.52/mdbook-v0.4.52-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH - name: Deploy docs run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 39156d3d1..4f4e572ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -275,7 +275,7 @@ jobs: - name: Install mdbook run: | mkdir mdbook - curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.44/mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.52/mdbook-v0.4.52-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH - run: cd src/doc && mdbook build --dest-dir ../../target/doc - name: Run linkchecker.sh diff --git a/src/doc/book.toml b/src/doc/book.toml index 6199a58e5..d748e6ee6 100644 --- a/src/doc/book.toml +++ b/src/doc/book.toml @@ -14,7 +14,59 @@ use-boolean-and = true "CHANGELOG.md" = { enable = false } [output.html.redirect] -"/guide/build-cache.html" = "../reference/build-cache.html" "/commands/cargo-git-checkout.html" = "./deprecated-and-removed.html" "/commands/cargo-read-manifest.html" = "./deprecated-and-removed.html" "/commands/cargo-verify-project.html" = "./deprecated-and-removed.html" +"/guide/build-cache.html" = "../reference/build-cache.html" +"/reference/manifest.html#building-dynamic-or-static-libraries" = "cargo-targets.html#the-crate-type-field" +"/reference/manifest.html#configuring-a-target" = "cargo-targets.html#configuring-a-target" +"/reference/manifest.html#examples" = "cargo-targets.html#examples" +"/reference/manifest.html#integration-tests" = "cargo-targets.html#integration-tests" +"/reference/manifest.html#package-build" = "manifest.html#the-build-field" +"/reference/manifest.html#package-metadata" = "manifest.html#the-package-section" +"/reference/manifest.html#package-selection" = "workspaces.html#package-selection" +"/reference/manifest.html#rules" = "features.html" +"/reference/manifest.html#rust-version" = "rust-version.html" +"/reference/manifest.html#target-auto-discovery" = "cargo-targets.html#target-auto-discovery" +"/reference/manifest.html#tests" = "cargo-targets.html#tests" +"/reference/manifest.html#the-authors-field-optional" = "manifest.html#the-authors-field" +"/reference/manifest.html#the-build-field-optional" = "manifest.html#the-build-field" +"/reference/manifest.html#the-documentation-field-optional" = "manifest.html#the-documentation-field" +"/reference/manifest.html#the-edition-field-optional" = "manifest.html#the-edition-field" +"/reference/manifest.html#the-exclude-and-include-fields-optional" = "manifest.html#the-exclude-and-include-fields" +"/reference/manifest.html#the-features-section" = "features.html#the-features-section" +"/reference/manifest.html#the-links-field-optional" = "manifest.html#the-links-field" +"/reference/manifest.html#the-metadata-table-optional" = "manifest.html#the-metadata-table" +"/reference/manifest.html#the-patch-section" = "overriding-dependencies.html#the-patch-section" +"/reference/manifest.html#the-project-layout" = "../guide/project-layout.html" +"/reference/manifest.html#the-publish--field-optional" = "manifest.html#the-publish-field" +"/reference/manifest.html#the-replace-section" = "overriding-dependencies.html#the-replace-section" +"/reference/manifest.html#the-required-features-field-optional" = "cargo-targets.html#the-required-features-field" +"/reference/manifest.html#the-workspace--field-optional" = "manifest.html#the-workspace-field" +"/reference/manifest.html#the-workspace-section" = "workspaces.html#the-workspace-section" +"/reference/manifest.html#usage-in-end-products" = "features.html" +"/reference/manifest.html#usage-in-packages" = "features.html" +"/reference/manifest.html#using-patch-with-multiple-versions" = "overriding-dependencies.html#using-patch-with-multiple-versions" +"/reference/manifest.html#virtual-workspace" = "workspaces.html" +"/reference/registries.html#index-format" = "registry-index.html" +"/reference/registries.html#login" = "registry-web-api.html#login" +"/reference/registries.html#owners" = "registry-web-api.html#owners" +"/reference/registries.html#owners-add" = "registry-web-api.html#owners-add" +"/reference/registries.html#owners-list" = "registry-web-api.html#owners-list" +"/reference/registries.html#owners-remove" = "registry-web-api.html#owners-remove" +"/reference/registries.html#publish" = "registry-web-api.html#publish" +"/reference/registries.html#running-a-registry" = "running-a-registry.html" +"/reference/registries.html#search" = "registry-web-api.html#search" +"/reference/registries.html#unyank" = "registry-web-api.html#unyank" +"/reference/registries.html#web-api" = "registry-web-api.html" +"/reference/registries.html#yank" = "registry-web-api.html#yank" +"/reference/resolver.html#other-constraints" = "#constraints-and-heuristics" +"/reference/resolver.html#pre-releases" = "specifying-dependencies.html#pre-releases" +"/reference/resolver.html#version-metadata" = "specifying-dependencies.html#version-metadata" +"/reference/specifying-dependencies.html#overriding-dependencies" = "overriding-dependencies.html" +"/reference/specifying-dependencies.html#overriding-repository-url" = "overriding-dependencies.html#overriding-repository-url" +"/reference/specifying-dependencies.html#overriding-with-local-dependencies" = "overriding-dependencies.html#paths-overrides" +"/reference/specifying-dependencies.html#prepublishing-a-breaking-change" = "overriding-dependencies.html#prepublishing-a-breaking-change" +"/reference/specifying-dependencies.html#testing-a-bugfix" = "overriding-dependencies.html#testing-a-bugfix" +"/reference/specifying-dependencies.html#working-with-an-unpublished-minor-version" = "overriding-dependencies.html#working-with-an-unpublished-minor-version" +"/reference/workspaces.html#virtual-manifest" = "workspaces.html#virtual-workspace" diff --git a/src/doc/src/reference/manifest.md b/src/doc/src/reference/manifest.md index 7c210f5b4..5f1074f8e 100644 --- a/src/doc/src/reference/manifest.md +++ b/src/doc/src/reference/manifest.md @@ -647,46 +647,3 @@ more detail. [spdx-license-list-3.20]: https://github.com/spdx/license-list-data/tree/v3.20 [SPDX site]: https://spdx.org [TOML]: https://toml.io/ - - diff --git a/src/doc/src/reference/registries.md b/src/doc/src/reference/registries.md index 12c91f1ae..f59a1ead8 100644 --- a/src/doc/src/reference/registries.md +++ b/src/doc/src/reference/registries.md @@ -129,29 +129,3 @@ controlled via the [`registries.crates-io.protocol`] config key. [config]: config.md [crates.io]: https://crates.io/ [`registries.crates-io.protocol`]: config.md#registriescrates-ioprotocol - - - diff --git a/src/doc/src/reference/resolver.md b/src/doc/src/reference/resolver.md index efda79d46..d5a30a0f6 100644 --- a/src/doc/src/reference/resolver.md +++ b/src/doc/src/reference/resolver.md @@ -697,19 +697,3 @@ circumstances: dependency. [`cargo install`]: ../commands/cargo-install.md - - diff --git a/src/doc/src/reference/specifying-dependencies.md b/src/doc/src/reference/specifying-dependencies.md index 1bc246c8f..c53f15f40 100644 --- a/src/doc/src/reference/specifying-dependencies.md +++ b/src/doc/src/reference/specifying-dependencies.md @@ -667,22 +667,3 @@ rand = { workspace = true, optional = true } [workspace.dependencies]: workspaces.md#the-dependencies-table [optional]: features.md#optional-dependencies [features]: features.md - - diff --git a/src/doc/src/reference/workspaces.md b/src/doc/src/reference/workspaces.md index c42b777de..a923e3ebd 100644 --- a/src/doc/src/reference/workspaces.md +++ b/src/doc/src/reference/workspaces.md @@ -299,17 +299,3 @@ if that makes sense for the tool in question. [specifying-dependencies]: specifying-dependencies.md [features]: features.md [inheriting-a-dependency-from-a-workspace]: specifying-dependencies.md#inheriting-a-dependency-from-a-workspace - -