Remove all formatting after the div
See the question and my original answer on StackOverflowThe Html Agility Pack can indeed close tags automatically. For example, this code
string html = "<div>hello<b>bold<i>and italic";
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
doc.Save(Console.Out);
Will output this:
<div>hello<b>bold<i>and italic</i></b></div>