I need to track changes between different versions of html snippets, the ideal solution would add css classes to changes like the following example (the example is simple, but complex changes should works too).
version 1
<ul id="items">
<li>one</li>
<li>two</li>
</ul>
version 2
<ul id="items">
<li>one</li>
<li>four</li>
</ul>
the result expected, the changes between version 1 and 2
<ul id="items">
<li>one</li>
<li class="removed">two</li>
<li class="added">four</li>
</ul>
— UPDATE 29 april 2013
Google Diff Match PATCH is awesome to compare two blocks of plain text, could be usefull too
— UPDATE 22 July 2013
same library as above available in seven different ports C++ C# Dart Java Javascript Lua Objectives C and Python
https://github.com/rdt1/hardcore
htmldiff will do the job
other references can be found at