Blog

Or search support forum

What's Global Moxie?

Global Moxie is the hypertext laboratory of Josh Clark, whose projects include the Big Medium web content management system. Josh creates web applications and websites from his multimedia studio in Paris, France.

What's Big Medium?

Big Medium is flexible, easy-to-use server software for creating and editing websites directly from your browser. Check out the features or download now.

Moxiemail

Enter your e-mail to receive occasional updates:

And speaking of version control...

Posted Jul 12, 2007 (updated Aug 3, 2007)

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: ,

Want more? Recent blog entries...

Add a Comment

Don't be shy.

( )

( Use Markdown for formatting.)

Download Big Medium
Try it free for 30 days, or buy to unlock.

State of Josh's Brain