Is there a JS diff library against htmlstring just like google-diff-match-patch on plain text?

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-01-25T14:31:14Z Indexed on 2010/05/21 21:00 UTC
Read the original article Hit count: 534

Filed under:
|
|

Currently I am using google-diff-match-patch to implement a real-time editing tool, which can synchronize texts between multiple users. Everything works great when operations are only plain texts, each user's operation(add/delete texts) could be diff-ed out by comparing to old text snapshot with the helper of google-diff. But when rich format texts(like bold/italic) are involved, google-diff not working well when comparing the htmlstring. The occurrence of character of < and > messed up the diff results, especially when bold/italic format are embedded within each other.

Could anyone suggest a similar library like google-diff to diff htmlstrings? Or any suggestions can get my problem fixed with google-diff? I understood google-diff is designed for plain text, but really didn't find a better library than it so far, so it also works if a doable enhancement to google-diff can help.

Thanks for any comments.

Regards,

Steve

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html