aaronsw / htmldiff

Highlights the differences between two HTML pages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malformed HTML output

ddohler opened this issue · comments

Due to the way difflib.SequenceMatcher selects the longest match, ins tags may sometimes be placed in ways that result in malformed HTML. Example below.

>>> a = "<p>a</p><p>This is a test.</p>"
>>> b = "<p>a</p><p>b</p><p>This is a test.</p>"
>>> diff.textDiff(a,b)
'<p>a<ins class="diff"></p><p>b</ins></p><p>This is a test.</p>'