We're looking to show a revision history between two text entries, ideally using semantic html with demarcating edits tags:

So for example:

Old Text

Stack Overflow is a question site for professional and enthusiast programmers

New Text

Stack Overflow is a question site for enthusiast programmers like you

Resulting Text:

Stack Overflow is a question site for <del>professional and</del> enthusiast programmers <ins>like you</ins>

A simple word by word diff is likely to run into challenges as soon as the string is resumed if it's been replaced with more than one word at a time.

The diff doesn't necessarily need to markup the final product, but even just getting a tokenized list of revisions would be really helpful, perhaps by leveraging something like git.

Any libraries that already handle something similar, preferably using javascript or node?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.