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 Answer 1

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);
            }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.