mdbook/crates/mdbook-compare
Eric Huss 21e8c08827 Add a basic utility to compare different versions of mdbook
This is a very simplistic utility to compare the output of different
versions of mdbook. This is useful when making changes to compare
real-world books to see what changes actually happen.

This is a variation of scripts that I have been using for a few years.
This could definitely use some improvements, but this seems like it
could be useful as-is.
2025-09-16 13:58:20 -07:00
..
src Add a basic utility to compare different versions of mdbook 2025-09-16 13:58:20 -07:00
Cargo.toml Add a basic utility to compare different versions of mdbook 2025-09-16 13:58:20 -07:00
README.md Add a basic utility to compare different versions of mdbook 2025-09-16 13:58:20 -07:00

mdbook-compare

This is a simple utility to compare the output of two different versions of mdbook.

To use this:

  1. Install tidy.
  2. Install or build the initial version of mdbook that you want to compare.
  3. Install or build the new version of mdbook that you want to compare.
  4. Run mdbook-compare with the arguments to the mdbook executables and the books to build.
cargo run --manifest-path /path/to/mdBook/Cargo.toml -p mdbook-compare -- \
    /path/to/orig/mdbook /path/to/my-book /path/to/new/mdbook /path/to/my-book

It takes two separate paths for the book to use for "before" and "after" in case you need to customize the book to run on older versions. If you don't need that, then you can use the same directory for both the before and after.

mdbook-compare will do the following:

  1. Clean up any book directories.
  2. Build the book with the first mdbook.
  3. Build the book with the second mdbook.
  4. The output of those two commands are stored in directories called compare1 and compare2.
  5. The HTML in those directories is normalized using tidy.
  6. Runs git diff to compare the output.