Google diff match patch tools

May 18, 2010

This google code library can be used to produce rich diffs of text, complete with strikeout and colour highlighting. It has language support for c++, csharp, javascript, python, lua and java.


To produce a nice HTML diff, use this code:

from diff_match_patch import diff_match_patch

lDiffClass = diff_match_patch()
lDiffs = lDiffClass.diff_main(lFromText, lToText)
lDiffHtml = lDiffClass.diff_prettyHtml(lDiffs)

There a demo page you can play with at