mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
Since HTML is a tree-like language it is futile to compare it character for character. `html1 === html2` is almost always false. This commit introduces a simple diffing algorithm that only checks the text inside the html + a few other attributes to decide whether the 2 HTMLs are actually different or not. This is obviously not foolproof and it will ignore everything aesthetic (b, em, strong tags etc.). This is actually desireable because in our case only the text difference should warrant a conflict. Everything else can easily be brought back. Similarly, this also ignores whitespace differences surrouding the tags. All in all it'll provide a more reliable alternative to MD5 hashing the 2 HTMLs.