After 15 years, HTMLDiff is back from the dead!
Version 1.0.0 does not break the basic syntax of HTMLDiff.diff(a, b) API,
however, please note the following changes:
The output diff HTML will now simple <ins> and <del> tags by default,
without adding the HTML classes diffins and diffdel, diffmod.
HTMLDiff.diff('Sad', 'Happy')
# Old output
'<del class="diffmod">Sad</del><ins class="diffmod">Happy</ins>'
# New output
'<del>Sad</del><ins>Happy</ins>'To get the exact legacy behavior, use:
html_format = { class_insert: 'diffins', class_delete: 'diffdel', class_replace: 'diffmod' }
HTMLDiff.diff(old_text, new_text, html_format: html_format)Most legacy classes have been removed or refactored. For compatibility purposes,
the HTMLDiff::DiffBuilder class has been kept but is now deprecated and raises a warning.
Please change usages as follows:
# Old
HTMLDiff::DiffBuilder.new(a, b).build
# Replace with
HTMLDiff.diff(a, b)The diff algorithm has been switched to use the diff-lcs gem which fixes many bugs,
but may result in slightly different output in some cases.
Please refer to README.md for the latest usage instructions and examples of how to tweak and customize HTMLDiff.