GithubHelp home page GithubHelp logo

htmldiff's Introduction

The code is this repo is very old and is here to be read and learned from. It is not maintained. ๐Ÿ•ถ

- - -

class Stuff

  class << self
    include HTMLDiff
  end
  
  # or extend HTMLDiff ?

end

Stuff.diff('a word is here', 'a nother word is there')

# => 'a<ins class=\"diffins\"> nother</ins> word is <del class=\"diffmod\">here</del><ins class=\"diffmod\">there</ins>'

Checkout the crappy specs for good examples. 

htmldiff's People

Contributors

ekampf avatar huacnlee avatar myobie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

htmldiff's Issues

how to ignore whitespaces difference while taking htmldiff

hi
I want to know how can I ignore the white spaces which too get into
account while taking the difference between the two html

I mean if I have an html like this

<html>
<body>
hi in body
</body>
</html>

and suppose I insert a space between the html an body tag like this

<html>
[space]
<body>
hi in body
</body>
</html>

then that white space is also consider as a difference which is true
but I want only those differences where certian text is changed or added

that mean i want to ignore whitespaces differences

Any Idea

Thank Anyway

Unexpected diffs

Documenting results I found to be suprising:

installed via npm, [email protected]

Combining tags from both before and after:

diff('<p>a <b>test</b></p>', '<p>a <div>test</div></p>')
'<p>a <b><div>test</b></div></p>'

Would not expect 'b' tag to remain in diff if it was not inside a tag.

keeping tags

diff('<p>a <b>test</b></p>', '<p>a test</p>')
'<p>a <b>test</b></p>'

Would expect '

a testtest

' or something similar

Remove a tag and edit text is a little better:

diff('<p>a <b>test</b></p>', '<p>a testt</p>')
'<p>a <b><del>test</del></b><ins>testt</ins></p>'

Can't handle converting list types

1.9.3p194 :041 > Stuff.diff "<ul><li>hi<//li><//ul>", "<ol><li>hi<//li><//ol>"
 => "<ul><ol><li>hi<//li><//ul><//ol>" 

Should probably do something else.

Slow

With an HTML file of around 600 lines, the program never finishes.

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.