pythonhtmldiffprettify

Generate pretty diff HTML in Python


I have two chunks of text that I would like to compare and see which words/lines have been added/removed/modified in Python (similar to a Wiki's Diff Output).

I have tried difflib.HtmlDiff but it's output is less than pretty.

Is there a way in Python (or external library) that would generate clean looking HTML of the diff of two sets of text chunks? (not just line level, but also word/character modifications within a line)


Solution

  • There's diff_prettyHtml() in the diff-match-patch library from Google.