Structure-aware and layout-aware perceptual hashing for HTML/DOM trees. Robust similarity detection, diffs, and resilience scoring with flexible CLI and API.
- Structural and visual similarity detection for DOM trees
- Layout-aware canonicalization with run-length encoding of layout shapes
- Run-length encoding (RLE) compression for shape vectors
- Hidden element support: prefixes and collapsing of consecutive hidden tags
- Flexible attribute handling: include/exclude data-, aria-, and custom attributes
- Resilience scoring to detect brittle or obfuscated DOMs with detailed penalties
- Support for perceptual hash algorithms:
sha256
,murmur3
,blake3
,simhash
,minhash
- Detailed structural diffs in Markdown/HTML output
- Rich CLI and programmatic API
- 100% test coverage and CI integration
npm install @iocium/domhash
Usage:
npx domhash <command> [options]
Commands:
hash [options] Compute hash of a DOM input compare [options] Compare two DOM inputs (structural & shape) diff [options] Show structural differences between two inputs shape [options] Output compressed shape vector of a DOM input layout [options] Output layout shape vector and layout hash resilience [options] Output resilience score and breakdown
For detailed help on a specific command:
npx domhash <command> --help
// Compare two pages and generate a Markdown report:
npx domhash compare page1.html page2.html --diff --output markdown > report.md
MIT License — see LICENSE for details.
Made with 💙 by iocium