Giter Club home page Giter Club logo

Comments (3)

jschroed91 avatar jschroed91 commented on August 23, 2024

@maliayas Thanks for opening this issue!

This is actually an undesired side-effect of one of the newer features we implemented - isolated tag diffing. I had not actually thought about this until now, so I'm very glad you opened this issue.

Basically, the isolated tag diffing is comparing the italic tags emergency escape and rescue openings separately from the rest of the content - this is to fix a lot of the issues we had with the diff output not protecting the HTML structure.
The issue here is that in order to diff them in isolated, we actually replace the entire tag with a placeholder "word" before we diff the content. The diffing algorithm is not aware of the length of the string that the placeholder represents, and therefore sees it as 1 word, and in this case it is finding a longer match in shall be than it is in the placeholder match.

So, it will take a little of work, but is certainly possible. This will be one of the higher priorities to tackle.

from php-htmldiff.

maliayas avatar maliayas commented on August 23, 2024

I see. Great explanation. If fixing this, will break other stuff, don't worry about this issue. I understand that perfecting a diff library may be quite complex.

Btw. demo tool is awesome.

from php-htmldiff.

jschroed91 avatar jschroed91 commented on August 23, 2024

Looping back around here - our highest priority of this library was the accuracy of the diff, so unfortunately performance took a back seat to it. However, we do like to leave that decision up to the end users when we can - the config option setIsolatedDiffTags is used to define which tags are diffed in isolation, and currently the defaults include i and em tags.

I'll see if I can update the documentation to highlight the reasoning behind choosing this as the default option this weekend.

Closing this issue.

from php-htmldiff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.