0

I am using diff match patch https://github.com/google/diff-match-patch to compare text of a html file and its working as expected. But the user want's to add a functionality to compare the format (bold, italic, underline)

But the diff match patch accept only string.

I created a class that holds the text and its font property of the html files

class TextProperty
{
    public string Text { get; set; }
    public bool isBold { get; set; }
    public bool isItalic { get; set; }
    public bool isUnderline { get; set; }
}

But the problem now i have is when i read the html content. i read it by text. and i append the text that has the same format

example i have this sample text

enter image description here

So my output is

This is a normal text with : isBold = false : isItalic = false : isUnderline = false
bold : isBold = true: isItalic = false : isUnderline = false
and : isBold = false : isItalic = false : isUnderline = false
italic : isBold = false : isItalic = true : isUnderline = false
and : isBold = false : isItalic = false : isUnderline = false
underline : isBold = false : isItalic = false : isUnderline = true
text : isBold = false : isItalic = false : isUnderline = false

But with this output How can i pass this in my diff match pass.

If i modify the diff match patch. That it will accept List of TextProperty

is it a good way to do this way? or any better option?

But upon reading the code of diff-match-patch i need to modify a lot of codes

Ramon bihon
  • 385
  • 1
  • 5
  • 18
  • you already get an output of ***string***: "This is a normal text with ...isUnderline = false", what if you pass this string into `diff match patch`? two HTML will be treated as identical only the output is all the same. – kennyzx Nov 06 '18 at 07:16
  • 1
    The output of diff match patch is html file. I modified it to have a color red(Removed) and green(Inserted) . But now i want to pass List in the diff match patch in order to add a feature which it can also check if the text font are equal. – Ramon bihon Nov 06 '18 at 08:45

0 Answers0