Opinionated HTML formatter that normalizes HTML for readable diffs, especially in snapshot testing. Version 6.0.1 is current, with infrequent major releases for breaking default changes. It indents every level with 2 spaces, aligns attributes, places every opening/closing tag on its own line, and trims text nodes. Unlike js-beautifier, it ensures inner content of each tag is on its own line and closing brackets are on their own line, making diffs clearer. Primarily used with Jest snapshot testing for Vue.js components.
npm install diffable-htmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats an HTML string into a diffable format with indentation and line breaks.
Do not rely on this for visual rendering; use for diff readability only.
Use dynamic import() or update project to ESM.
Pin to major version or use alternative if custom formatting needed.
Use or preformat if preserving spaces is required.
Add "type": "module" to package.json or use dynamic import.
Use import toDiffableHtml from 'diffable-html' (default import).
Use const { default: toDiffableHtml } = require('diffable-html') or dynamic import.No dependency data recorded yet.