Reputation: 57
I'm trying to beautify html from string using tidyhtml5managed, code is:
using (Document doc = Document.FromString(myhtmltext)) //<html><head><...
{
doc.IndentAttributes = true;
doc.CleanAndRepair();
Literal1.Text = doc.ToString();
}
I got output like this
TidyManaged.Document
My question is how to get html beautified output? Sorry for my bad English.
Upvotes: 0
Views: 329
Reputation: 13960
What about reading the manual? Just call Save()
instead of ToString()
using (Document doc = Document.FromString(dirtyHtml))
{
doc.OutputBodyOnly = AutoBool.Yes;
doc.Quiet = true;
doc.CleanAndRepair();
string cleanHtml = doc.Save();
Console.WriteLine("Clean HTML: " + cleanHtml);
}
Upvotes: 1