Skip to content

upgrade: migrate mdbook to 0.5.3#3207

Merged
michael-kerscher merged 1 commit into
google:mainfrom
michael-kerscher:mdbook-update
Jun 12, 2026
Merged

upgrade: migrate mdbook to 0.5.3#3207
michael-kerscher merged 1 commit into
google:mainfrom
michael-kerscher:mdbook-update

Conversation

@michael-kerscher

@michael-kerscher michael-kerscher commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

This commit upgrades mdbook from 0.4.52 to 0.5.3, which is a major upgrade with breaking changes.

Key changes:

  • Upgraded mdbook to 0.5.3, mdbook-pandoc to 0.11.0, mdbook-i18n-helpers to 0.4.0, and mdbook-linkcheck2 to 0.12.0 in xtask for mdbook 0.5 compatibility.
  • Migrated local preprocessor plugins mdbook-course and mdbook-exerciser to use the new split crates structure of mdbook 0.5 (mdbook-core, mdbook-preprocessor, mdbook-renderer).
    • Replaced usage of removed preprocess::CmdPreprocessor with mdbook_preprocessor::parse_input.
    • Replaced usage of removed Config::get_renderer with generic Config::get.
    • Updated trait implementations to match new signatures (e.g. supports_renderer returning Result<bool>).
    • Refactored mdbook-exerciser configuration parsing to deserialize into a structured Config struct.
  • Migrated theme/index.hbs and theme/book.js to match the default files of mdbook 0.5.3, preserving local modifications (speaker notes, language picker, redbox, etc.).
  • Updated speaker notes icons in theme/index.hbs and theme/speaker-notes.js to use xmark and arrow-up-right-from-square SVG templates for FontAwesome 6 compatibility (see renamed icons in https://docs-v6.fontawesome.com/web/setup/upgrade/whats-changed#icons-renamed-in-version-6).
  • Updated WebdriverIO test suite (tests/) to:
    • Support the new mdbook- prefixed HTML IDs (e.g., #mdbook-sidebar, #mdbook-theme-toggle).
    • Robustly handle default_theme verification by accepting either "light" or "navy" depending on the host system's prefers-color-scheme setting.
  • Upgraded mdbook-svgbob to 0.3.0 (which supports mdbook 0.5).
  • Updated .github/workflows/build.sh to sanitize the restored historical book.toml (removing deprecated multilingual and curly-quotes keys) to ensure compatibility with the mdbook 0.5.3 configuration parser.

Fixes #3201

@michael-kerscher

Copy link
Copy Markdown
Collaborator Author

This commit has a workaround for the blocker for the mdbook-svgbob crate as this is an actual blocker for this upgrade. We can either submit this as-is or wait for a new version of the dependency to be released

@qwandor qwandor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also #3075, where I made a bunch of the same fixes.

I think we should wait for a new release of mdbook-svgbob first. @mgeisler aren't you a maintainer of it? Can you get boozook/mdbook-svgbob#98 merged and a new release out?


# Sanitize book.toml for mdbook 0.5 compatibility
sed -i '/multilingual/d' book.toml
sed -i '/curly-quotes/d' book.toml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Can't the book.toml be rather than patching it here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah… I did not see #3075 and only checked the issues and did not find anything in there.

Regarding why this the sed is necessary (I assumed a missing "modified" in the sentence): because of the way we support translations at the moment - see #3201 - we cannot simply use the fresh book.toml for these reasons but the old one does not play nice with the new version so we need to make them compatible or the translation webpages get stale because they are not built with new versions anymore.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the actual problem is that book.toml became backdated as of #2658. That was not originally the case, but I understand it happened so that the Rust edition field from the backdated book.toml can apply.

I'm restructuring this as we speak with my Bazel build: there I use book.toml from latest main, but I adopt the Rust edition from the backdated book.toml file.

That should give us correct semantics: we build all translations with the current version of mdbook and we do so with the latest and greatest book.toml file. The translations altern content, and some of this content is Rust code, which means that we must respect the Rust edition in force at the time of the translation.

I hope you can merge this and then I'll rebase and update my unpushed work with Bazel on top of this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just published mdbook-svgbob 0.3.0 with mdbook 5.0 support thanks to the updates from @qwandor!

@mgeisler

Copy link
Copy Markdown
Collaborator

@mgeisler aren't you a maintainer of it? Can you get boozook/mdbook-svgbob#98 merged and a new release out?

Oh, right, indeed I am 😄 I approved your PR and I should be able to make a release now.

@michael-kerscher

Copy link
Copy Markdown
Collaborator Author

I included mdbook-svgbob-0.3.0 - tests are running

@michael-kerscher

michael-kerscher commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

@mgeisler can you have a look at the new bazel cache layer. Seems to be a bit heavy.

/usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf: Cannot mkdir: No space left on device

(click to see full logs)

Prepare all required actions
Getting action download info
Download action repository 'bazel-contrib/setup-bazel@0.19.0' (SHA:c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86)
Run ./.github/workflows/setup-bazel-cache
Run bazel-contrib/setup-bazel@0.19.0
Configure Bazel
Restore cache for bazelisk
Restore cache for disk-true
Restore cache for repository
  Cache hit for: setup-bazel-1-linux-x64-repository-b5fd8ae5e0e54a094905bbcdb603a9c0e3375eb944e6b0b4926933d1904e6f65
  Received 0 of 5434914379 (0.0%), 0.0 MBs/sec
  Received 100663296 of 5434914379 (1.9%), 48.0 MBs/sec
  Received 268435456 of 5434914379 (4.9%), 85.3 MBs/sec
  Received 432013312 of 5434914379 (7.9%), 103.0 MBs/sec
  Received 633339904 of 5434914379 (11.7%), 120.7 MBs/sec
  Received 805306368 of 5434914379 (14.8%), 127.9 MBs/sec
  Received 968884224 of 5434914379 (17.8%), 131.9 MBs/sec
  Received 1149239296 of 5434914379 (21.1%), 136.9 MBs/sec
  Received 1329594368 of 5434914379 (24.5%), 140.8 MBs/sec
  Received 1476395008 of 5434914379 (27.2%), 140.7 MBs/sec
  Received 1677721600 of 5434914379 (30.9%), 145.3 MBs/sec
  Received 1849688064 of 5434914379 (34.0%), 146.9 MBs/sec
  Received 2013265920 of 5434914379 (37.0%), 147.6 MBs/sec
  Received 2185232384 of 5434914379 (40.2%), 148.7 MBs/sec
  Received 2369781760 of 5434914379 (43.6%), 150.5 MBs/sec
  Received 2533359616 of 5434914379 (46.6%), 150.9 MBs/sec
  Received 2713714688 of 5434914379 (49.9%), 152.1 MBs/sec
  Received 2906652672 of 5434914379 (53.5%), 153.9 MBs/sec
  Received 3087007744 of 5434914379 (56.8%), 154.8 MBs/sec
  Received 3254779904 of 5434914379 (59.9%), 155.1 MBs/sec
  Received 3443523584 of 5434914379 (63.4%), 156.2 MBs/sec
  Received 3623878656 of 5434914379 (66.7%), 156.9 MBs/sec
  Received 3753902080 of 5434914379 (69.1%), 155.5 MBs/sec
  Received 3925868544 of 5434914379 (72.2%), 155.8 MBs/sec
  Received 4093640704 of 5434914379 (75.3%), 156.0 MBs/sec
  Received 4286578688 of 5434914379 (78.9%), 157.1 MBs/sec
  Received 4450156544 of 5434914379 (81.9%), 157.0 MBs/sec
  Received 4643094528 of 5434914379 (85.4%), 158.0 MBs/sec
  Received 4827643904 of 5434914379 (88.8%), 158.6 MBs/sec
  Received 4966055936 of 5434914379 (91.4%), 157.7 MBs/sec
  Received 5125439488 of 5434914379 (94.3%), 157.5 MBs/sec
  Received 5293211648 of 5434914379 (97.4%), 157.6 MBs/sec
  Received 5434914379 of 5434914379 (100.0%), 157.5 MBs/sec
  Cache Size: ~5183 MB (5434914379 B)
  /usr/bin/tar -xf /home/runner/work/_temp/c21d7ec4-1050-4e95-993a-7f65e6008dab/cache.tzst -P -C /home/runner/work/comprehensive-rust/comprehensive-rust --use-compress-program unzstd
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/3b772976fec7bdcda1d84b9d39b176589424c047eb2175bed09aac630e50af43/file: Wrote only 9216 of 10240 bytes
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718/id-9e19a279a10c63286b7e2fce990996a4855e10486f8954bffccd9a85c39a57ef: Cannot open: No such file or directory
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718/file: Cannot open: No such file or directory
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf/file: Cannot open: No such file or directory
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf: Cannot mkdir: No space left on device
  /usr/bin/tar: ../../../.cache/bazel-repo/content_addressable/sha256/ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf/id-40899f4361f384fab57589b7fab8be52e2150eee697db298d17f050197c6beeb: Cannot open: No such file or directory

Comment thread mdbook-exerciser/src/main.rs Outdated
This commit upgrades mdbook from 0.4.52 to 0.5.3, which is a major upgrade with
breaking changes.

Key changes:
- Upgraded mdbook to 0.5.3, mdbook-pandoc to 0.11.0, mdbook-i18n-helpers to 0.4.0, and mdbook-linkcheck2 to 0.12.0 in `xtask` for mdbook 0.5 compatibility.
- Migrated local preprocessor plugins `mdbook-course` and `mdbook-exerciser` to use the new split crates structure of mdbook 0.5 (mdbook-core, mdbook-preprocessor, mdbook-renderer).
  - Replaced usage of removed `preprocess::CmdPreprocessor` with `mdbook_preprocessor::parse_input`.
  - Replaced usage of removed `Config::get_renderer` with generic `Config::get`.
  - Updated trait implementations to match new signatures (e.g. `supports_renderer` returning `Result<bool>`).
  - Refactored `mdbook-exerciser` configuration parsing to deserialize into a structured `Config` struct.
- Migrated `theme/index.hbs` and `theme/book.js` to match the default files of mdbook 0.5.3, preserving local modifications (speaker notes, language picker, redbox, etc.).
- Updated speaker notes icons in `theme/index.hbs` and `theme/speaker-notes.js` to use `xmark` and `arrow-up-right-from-square` SVG templates for FontAwesome 6 compatibility (see renamed icons in https://docs-v6.fontawesome.com/web/setup/upgrade/whats-changed#icons-renamed-in-version-6).
- Updated WebdriverIO test suite (`tests/`) to:
  - Support the new `mdbook-` prefixed HTML IDs (e.g., `#mdbook-sidebar`, `#mdbook-theme-toggle`).
  - Robustly handle `default_theme` verification by accepting either "light" or "navy" depending on the host system's prefers-color-scheme setting.
- Upgraded `mdbook-svgbob` to 0.3.0 (which supports mdbook 0.5) and restored its installation from crates.io.
- Updated `.github/workflows/build.sh` to sanitize the restored historical `book.toml` (removing deprecated `multilingual` and `curly-quotes` keys) to ensure compatibility with the `mdbook` 0.5.3 configuration parser.

Fixes google#3201
@michael-kerscher michael-kerscher merged commit 1576198 into google:main Jun 12, 2026
42 checks passed
@michael-kerscher michael-kerscher deleted the mdbook-update branch June 12, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade mdbook to 0.5.x

3 participants