Generate pretty diff html in Python

后端 未结 7 602
日久生厌
日久生厌 2020-12-02 07:50

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 ha

7条回答
  •  暖寄归人
    2020-12-02 08:32

    A copy of my own answer from here.


    What about DaisyDiff (Java and PHP vesions available).

    Following features are really nice:

    • Works with badly formed HTML that can be found "in the wild".
    • The diffing is more specialized in HTML than XML tree differs. Changing part of a text node will not cause the entire node to be changed.
    • In addition to the default visual diff, HTML source can be diffed coherently.
    • Provides easy to understand descriptions of the changes.
    • The default GUI allows easy browsing of the modifications through keyboard shortcuts and links.

提交回复
热议问题