html-agility-pack icon indicating copy to clipboard operation
html-agility-pack copied to clipboard

Format and indent HTML

Open vanillajonathan opened this issue 4 years ago • 1 comments

There could be a feature to format and indent code.

var html = @"<!DOCTYPE html><html><body><h1>
This is <b>bold</b> heading</h1><p>This is <u>underlined</u> paragraph</p>
<h2>This is <i>italic</i> heading</h2></body></html>";

var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);

To get this ugly HTML code beautifully outputted to:

<!DOCTYPE html>
<html>
<body>
  <h1>This is <b>bold</b> heading</h1>
  <p>This is <u>underlined</u> paragraph</p>
  <h2>This is <i>italic</i> heading</h2>
</body>
</html> 

vanillajonathan avatar Mar 24 '21 13:03 vanillajonathan

Thank you for this suggestion,

At this moment, we have no plan to implement something like this but this is indeed a good idea.

Best Regards,

Jon


Sponsorship Help us improve this library

Performance Libraries context.BulkInsert(list, options => options.BatchSize = 1000); Entity Framework ExtensionsBulk OperationsDapper Plus

Runtime Evaluation Eval.Execute("x + y", new {x = 1, y = 2}); // return 3 C# Eval FunctionSQL Eval Function

JonathanMagnan avatar Mar 24 '21 14:03 JonathanMagnan