Global Moxie

http://globalmoxie.com/blog/diff-javascript.shtml

And speaking of version control...

Neil Fraser's diff library makes it easy to compare blocks of text.

By

If you're developer looking for an easy way to display differences between two different chunks of text, I highly recommend Neil Fraser's diff-match-patch code library. Neil works for Google, and his library is used in Google Documents... and now Big Medium, too.

The open-source library (LGPL license) is available in Java, JavaScript and Python and makes for a great drop-in to add diff support to your app.

Big Medium uses the JavaScript library to diff text versions, and it reduces the whole operation to just four lines of code:

var dmp = new diff_match_patch();
var d = dmp.diff_main(oldText, newText);
dmp.diff_cleanupSemantic(d);
var html = dmp.diff_prettyHtml(d)
Screenshot - Edit history comparison
Click to enlarge.

Sweet.

Tags: ,