I want to generate a diff between to revisions of text (more specifically, Markdown-formatted articles) in Python.
I want to format this diff in a manner similar to what Github does.
I've looked at difflib
and have found that it does what I want. However, the Differ
class is too high-level; I would have to parse the diff lines to generate HTML with inline diffs. The Differ
class uses the SequenceMatcher
class to generate its diffs. But looking at the SequenceMatcher
it's very low-level in comparison. I haven't even figured out how to do a line-by-line diff (I'll admit I haven't spent a lot of time experimenting).
Does anyone know of any resources for using the SequenceMatcher
class (besides the difflib
documentation)?