T
T
Teraxis2013-05-27 23:15:37
JavaScript
Teraxis, 2013-05-27 23:15:37

Comparing html content (google-diff-match-patch alternative)?

To compare content and display differences between two texts, I use the google-diff-match-patch library . The problem is that the script does not work with html markup, but only understands text/plain. Does anyone know alternative javascripts that allow you to compare two texts with html markup?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
Y
yetanotherape, 2013-05-28
@Teraxis

The author of google-diff-match-patch suggests the following solutions to this problem

M
MaxUp, 2013-05-28
@MaxUp

asked a similar question a couple of months ago :
github.com/cemerick/jsdifflib
en.wikipedia.org/wiki/User :Cacycle/diff
www.raymondhill.net/finediff/viewdiff-ex.php

S
Stanislav, 2013-05-28
@crackedmind

github.com/tnwinc/htmldiff.js Used the ruby ​​version on which it is based. Everything seemed to work as it should.

M
Mark, 2020-05-03
@printf

I've implemented comparison of HTML fragments without a bunch of unnecessary dependencies here: https://www.npmjs.com/package/assert-equal-html
Works correctly with classes, attributes, self-closing / void elements, ignores comments and doctype.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question