I'm using this library wrapper for HTML Tidy in .NET: https://github.com/markbeaton/TidyManaged
it has a simple example:
using System;
using TidyManaged;
public class Test
{
public static void Main(string[] args)
{
using (Document doc = Document.FromString("<hTml><title>test</tootle> <body>asd</body>"))
{
doc.ShowWarnings = false;
doc.Quiet = true;
doc.OutputXhtml = true;
doc.CleanAndRepair();
string parsed = doc.Save();
Console.WriteLine(parsed);
}
}
}
I want to use the library for a piece of HTML not a full page with "html" and "body" tags. Is it possible?
I basically want to validate opening and closing tags and remove tags with no matching opening.