HtmlPrettyFormatter Class
Writes an indented HTML markup, to read or compare documents: each node is written on its own line, indented by its depth, and the whitespace of the text is collapsed and trimmed.
public sealed class HtmlPrettyFormatter : HtmlFormatterRemarks
The whitespace is not significant in the output, so the document it represents may be rendered differently: use HtmlFormatter.Default or HtmlMinifyFormatter to write a document that is served. The content of the elements whose whitespace is significant (pre, textarea, listing, script, style...) is written as is, except the CSS of the style elements when HtmlFormatter.StyleElementFormatter is set: it is written on the lines that follow the start tag, indented by the depth of its content. An element whose only content is a text is written on a single line.
- Inheritance
HtmlFormatterHtmlPrettyFormatter
Constructors
| Name | Description |
|---|---|
| HtmlPrettyFormatter() |
HtmlPrettyFormatter()
HtmlPrettyFormatter.cspublic HtmlPrettyFormatter()No documentation is available.
Properties
| Name | Description |
|---|---|
| Indentation | The string written for each level of indentation. The default is two spaces. |
| MaxIndentationDepth | The maximum number of indentation levels: the content of the deeper elements is indented as the content at this depth. The default is 64, which bounds the size of the output of deeply nested input (the indentation of each line would grow with the depth). |
| NewLine | The line separator. The default is "\n". |
Indentation
HtmlPrettyFormatter.csMaxIndentationDepth
HtmlPrettyFormatter.csThe maximum number of indentation levels: the content of the deeper elements is indented as the content at this depth. The default is 64, which bounds the size of the output of deeply nested input (the indentation of each line would grow with the depth).
public int MaxIndentationDepth { get; init; }