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. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
mdbook-compare
This is a simple utility to compare the output of two different versions of mdbook.
To use this:
- Install
tidy. - Install or build the initial version of mdbook that you want to compare.
- Install or build the new version of mdbook that you want to compare.
- Run
mdbook-comparewith 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:
- Clean up any book directories.
- Build the book with the first mdbook.
- Build the book with the second mdbook.
- The output of those two commands are stored in directories called
compare1andcompare2. - The HTML in those directories is normalized using
tidy. - Runs
git diffto compare the output.