0

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.

1 Answers1

1

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);
            }
Oscar
  • 13,594
  • 8
  • 47
  • 75