Currently I am working on a solution to correct HTML. In our solution we have a rich text editor where we want to correct the HTML when the user forgets a <p> element, which happens a lot.
var input = new StringBuilder();
input.AppendLine("<h2>title1</h2>");
input.AppendLine("text");
input.AppendLine("<h2>title2</h2>");
input.AppendLine("<p>paragraph</p>");
var expected = new StringBuilder();
expected.AppendLine("<h2>title1</h2>");
expected.AppendLine("<p>text</p>");
expected.AppendLine("<h2>title2</h2>");
expected.AppendLine("<p>paragraph</p>");
Assert.AreEqual(expected.ToString(), input.DoSomething());
Is there something in the HTML agility pack? Of is there another solution?
No comments:
Post a Comment