caxy / php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML. Includes support for comparing complex lists and tables
http://php-htmldiff.caxy.com
GNU General Public License v2.0
202 stars 51 forks source link

Detecting link changes #28

Closed maliayas closed 8 years ago

maliayas commented 8 years ago

It seems, neither this fork nor the upstream can detect link changes. For example:

-<a href="http://lorem.com">this part doesn't change</a>
+<a href="http://ipsum.com">this part doesn't change</a>

GitHub rich text diff plays nice with this case. Styling is not in the scope of this library but I've captured some screenshots for inspiration. If ahref attribute is changed, GitHub dotted-underlines it and presents a tooltip:

ekran goruntusu 2016 02 21 22_25_38

Tooltip:

ekran goruntusu 2016 02 21 22_25_47

If link text is also changed, underline and tooltip is gone:

ekran goruntusu 2016 02 21 22_26_10

Could we have this detection in this library? Thanks in advance.

jschroed91 commented 8 years ago

Of course! I'm working on the table diffing feature now, I will try to sneak this in early this week. Unless someone else wants to put in a PR

maliayas commented 8 years ago

Thanks very much!

jschroed91 commented 8 years ago

@maliayas Just merged in updates to detect link changes - I didn't do anything fancy with tooltips since that is out of the scope of this library. But if a link is changed, the old link will be wrapped in a <del class="diffmod diff-href"></del> and the new link will be wrapped in <ins class="diffmod diff-href"></ins>

maliayas commented 8 years ago

Lovely! Problem solved. Btw I've made a code review to be helpful.

jschroed91 commented 8 years ago

It's very appreciated! Thank you @maliayas - I will look at your comments and make updates either today or tomorrow morning.

Feel free to suggest additional features/bug fixes in the future, and you are welcome to contribute / open PRs.

We don't have any documentation on contributing at this point, but I hope to do some major clean-up of the code and put together some documentation sometime in the near future.

maliayas commented 8 years ago

Very nice to hear this. Thanks.