A small JavaScript tool to do word-by-word diffs two strings of text.
Include diff.js in your page, then run:
differ.parse(string1, string2);
var differ = require('./js/diff.js').differ;
differ.parse(string1, string2);
Currently this parses the text for differences and marks deletions and insertions with
E.g.
differ.parse('one two three', 'two three four');
// Returns '$del$one $/del$ two three $ins$four$/ins$'
This code is primarily a restructuring of John Resig's 2005 post, JavaScript Diff Algorithm, which is based on Paul Heckel's 1978 paper A technique for isolating differences between files. I rewrote the code to make it a bit more modular and commented the shit out of it.