public abstract string textForChange(string text, DiffMatchPatch.Operation op);
            override public string textForChange(string text, DiffMatchPatch.Operation op)
            {
                if (text == "" || text == null)
                {
                    return("");
                }

                html.LoadHtml(text);
                var containsHtml = (html.DocumentNode.Descendants().Count() > 0);

                if (containsHtml)
                {
                    if (listElements.Any(text.Contains))
                    {
                        var listNodes = html.DocumentNode.Descendants().Where(n => n.Name == "li" || n.Name == "ol");

                        foreach (var li in listNodes)
                        {
                            addAttribute("class", Tuple.Create("styleDel", "styleIns"), op, li);
                        }
                    }

                    if (tableElements.Any(text.Contains))
                    {
                        var tableNodes = html.DocumentNode.Descendants().Where(t => t.Name == "table" || t.Name == "td" || t.Name == "tr");
                        foreach (var table in tableNodes)
                        {
                            if (table.Name == "table")
                            {
                                addAttribute("bordercolor", Tuple.Create("red", "green"), op, table);
                            }
                            else if (table.Name == "td")
                            {
                                addAttribute("class", Tuple.Create("tdDel", "tdIns"), op, table);
                            }
                            else
                            {
                                addAttribute("class", Tuple.Create("color: red", "color: green"), op, table);
                            }
                        }
                    }

                    if (text.Contains(div))
                    {
                        var divs = html.DocumentNode.Descendants().Where(d => d.Name == "div");
                        foreach (var div in divs)
                        {
                            addAttribute("class", Tuple.Create("styleDel", "styleIns"), op, div);
                        }
                    }

                    if (text.Contains(image))
                    {
                        var images    = html.DocumentNode.Descendants().Where(t => t.Name == "img").ToList();
                        var imagefile = (op == Operation.INSERT) ? "image-ins" : "image-del";
                        var svg       = "<img src='/Bundles/mco/images/" + imagefile + ".svg' class='svg' >";
                        foreach (var image in images)
                        {
                            addAttribute("class", Tuple.Create("imgDel", "imgIns"), op, image);
                            if (op != Operation.EQUAL)
                            {
                                image.ParentNode.InnerHtml = "<div class='img'>" + image.OuterHtml + "<br />" + svg + "</div>";
                            }
                        }
                    }

                    if (addedAttribute)
                    {
                        addedAttribute = false;
                        return(html.DocumentNode.OuterHtml);
                    }
                }

                switch (op)
                {
                case DiffMatchPatch.Operation.DELETE:
                    return("<del style=\"text-decoration: line-through;color: red;\">" + text + "</del>");

                case DiffMatchPatch.Operation.INSERT:
                    return("<ins style=\"text-decoration: underline;color: green;\">" + text + "</ins>");

                default:
                    return(text);
                }
            }
            public DiffSeg(Operation op, string text)
            {
                this.op   = op;
                this.text = text;
                text      = text.Trim();
                startTag  = true;

                if (text == null || text.Length == 0)
                {
                    return;
                }

                if (text.IndexOf("<!--") == 0)
                {
                    tagName     = "<!--";
                    selfClosing = true;
                    tag         = true;
                }
                else if (text[0] == '<')
                {
                    tag     = true;
                    tagName = "";

                    bool named = false;

                    foreach (var c in text)
                    {
                        if (!named)
                        {
                            if (c == '<')
                            {
                                continue;
                            }
                            if (c == '/')
                            {
                                if (tagName.Length > 0)
                                {
                                    selfClosing = true;
                                    named       = true;
                                    break;
                                }
                                else
                                {
                                    startTag = false;
                                }
                            }
                            else if (c != ' ' && c != '>')
                            {
                                tagName += c;
                            }
                            else if ((c == ' ' && tagName.Length > 0) || c == '>')
                            {
                                named = true;
                            }
                        }
                        else
                        {
                            if (c == '/')
                            {
                                selfClosing = true;
                                break;
                            }
                        }
                    }

                    //These elements are *always* self closing, so we'll let them slide if they didn't put the "/"
                    if (SELF_CLOSING_TAGS.Contains(tagName))
                    {
                        selfClosing = true;
                    }
                }

                if (CanHaveChildren)
                {
                    children = new List <DiffSeg>();
                }
            }