A simple tool for producing navigable, highlighted diffs of rendered HTML websites
Project description
Website Diff
website_diff
is a utility that compares two HTML websites, and outputs a diff as a third HTML website.
The diff site has insertion/deletion highlighting, automatic scroll-to-next and scroll-to-previous key bindings,
image diffing, and highlighting of links pointing to diffed pages.
Why would I use website_diff
?
This tool is primarily meant to help see/find differences in websites that are automatically generated from some source documents (e.g. documentation pages, Jupyterbooks, etc) that may not be obvious from source diffs produced by GitHub. This is particularly useful when the source documents run code whose output may silently change, even though the source files remain constant.
Installation
Ensure Rust and Cargo are installed. Instructions can be found here.
pip install --upgrade pip
pip install website_diff
Usage
website_diff
takes as an input two folders each containing an index.html
file, as well as the name of a third folder to be created
that will contain the diffed website.
website_diff --old path/to/old/site/ --new path/to/new/site/ --diff path/where/diff/site/will/be/created
If website_diff
runs successfully, the diff website will be available at
path/where/diff/site/will/be/created/index.html
To access the command line interface help documentation, run
website_diff --help
There are several examples that can demonstrate the kinds of differences that website_diff will detect.
To run website_diff on those examples, simply run the bash script run_tests.sh
found within the website_diff repo.
run_tests.sh
pulls the examples from a separate repo called website_diff_examples
.
The folder website_diff_examples/examples
contains several folders each representing a different example e.g. lines of text changed, image added, page added, etc.
In each of those folders, there will be an old
and prerendered_old
folder for the old website and old website with pre-rendered figures, new
and prerendered_new
for the new website and new website with pre-rendered figures, and lastly diff
for the diffed version of the website with an index.html
file that shows everything that has changed between the old and new versions of the website.
Navigation
To view diffs, open index.html
in the output folder (specified by the --diff option).
Text diffs are highlighted in green if text was inserted, red if text was deleted. Any links that point to a page containing diffs will have yellow text.
Any new image elements will have a green border and are highlighted in green, deleted image elements will have a red border and are highlighted in red.
If an old image source file was replaced with a new image file, the image on the diff'd page will be outlined in yellow and any differences in the image will be highlighted in red.
Keyboard controls
When first opening a page with diffs, the browser will scroll to the first diff on the page.
To scroll to the next off-page diff, press the n key.
To scroll to the previous off-page diff, press Shift+n or N.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file website_diff-0.0.1.tar.gz
.
File metadata
- Download URL: website_diff-0.0.1.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14df45f19c8442dc2f4204a409ebc4561f87f9e7e0428fb1b651c1f58fc260eb |
|
MD5 | ca386e6f75295d77f5ee78635f5b0c99 |
|
BLAKE2b-256 | f63102669ceb80ea67c6cb6d71ce246e21237124343a1f62fb10eec45059fd0a |
File details
Details for the file website_diff-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: website_diff-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 211.2 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25df8fdc5d82131b975e789dd94604c3e7b906cb81ad30592f4b011e2d9e271f |
|
MD5 | e666db85b0ee574e6beefea11341ee0a |
|
BLAKE2b-256 | 2764d34c630a6e7189a0373e4da35ae12b17a834632ca69aa5e6f4b679a130f0 |