While I am trying to create few components through Core service, to form XHTML we're using Tidy.net, but I found some dispensary in tidy.net. After parsing the content I see some additional "\r\n"added to the content as below

Original Content

enter image description here

After Parsing through Tidy.net After  Parsing through Tidy.net

My code as follows

MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes(source));
            MemoryStream output = new MemoryStream();

            TidyMessageCollection tmc = new TidyMessageCollection();
            Tidy tidy = new Tidy();

            tidy.Options.DocType = DocType.Omit;
            tidy.Options.DropFontTags = true;
            tidy.Options.LogicalEmphasis = true;
            tidy.Options.Xhtml = true;
            tidy.Options.XmlOut = true;
            tidy.Options.MakeClean = true;
            tidy.Options.TidyMark = false;
            tidy.Options.NumEntities = true;

            tidy.Parse(input, output, tmc);

Do we have any options with Tidy.net to avoid this additional Carriage return? Did anyone have handled this before?

  • 3
    Is there a tidy.Options.Wrap or similar? If this is an implementation of HTML Tidy, I believe it will wrap lines at around 68 characters. Apr 13, 2017 at 8:35

1 Answer 1


tidy.Options.WrapLen this resolved my problem

  • 1
    I think you should ask Dave Forber to make an answer with his comment since it helped you resolve your issue :) Apr 13, 2017 at 14:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.