anastasia / htmldiffer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
This means that "word" is considered different from "word,". Instead, only the comma should be considered different. Changing this would improve readability of output.
everything should be namespaced with htmldiffer
move WHITELISTED and other settings in there
d = HTMLDiffer('<h1>whatever</h1>', '<div>whatever</div>')
d.diff()'s combined_diff should potentially look like
'<div class="htmldiffer-tag-change">whatever</div>'
and attribute-level changes could look like:
d = HTMLDiffer('<div class="something">whatever</h1>', '<div class="something_else">whatever</div>')
d.diff()'s combined_diff should potentially look like
'<div class="htmldiffer-attribute-change">whatever</div>'
or
'<div class="htmldiffer-class-change">whatever</div>'
On top of current wip enhancement, would deal with #27, #28, #29
Also finish renaming
I just tried this scenario where the text is the same, but the element containing it is different:
d = diff.HTMLDiffer('<h1>whatever</h1>', '<div>whatever</div>')
d.combined_diff
# <h1><div>whatever</h1></div>
Iโm not totally sure what the ideal output here would be, but it would at least be good if elements properly contained each other, so the <h1>
contained the <div>
or vice-versa.
we should be able to see if the href in a link has changed
To increase fidelity of comparison: similar to Word's "Compare Documents" tool.
printing without parens!
because it is decidedly not, right now
If the same element name was used but had different attributes, the opening tag of the element is repeated in the combined_diff
(one for each side of the diff), but the closing tag is only output once (ostensibly because it is the same):
d = diff.HTMLDiffer('<a href="somewhere">Yeah</a>', '<a href="elsewhere">Yeah</a>')
d.combined_diff
# '<a href="somewhere"><a href="elsewhere">Yeah</a>'
# ^ Note two `<a...>`, but only one `</a>`
Or:
d = diff.HTMLDiffer('<div title="somewhere">Yeah and!</div>', '<div title="elsewhere">Yeah and.</div>')
d.combined_diff
# '<div title="somewhere"><div title="elsewhere">Yeah <span class="diff_delete">and!</span><span class="diff_insert">and.</span></div>'
It would be nice if there were a way to highlight the change in href
attributes here:
<a href="/somwhere">Some link text</a>
<a href="/somwhere-new">Some link text</a>
That could be generic for any kind of attribute, but it would at least be really helpful for particular ones like href
, src
, title
, alt
on images, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.