Table of Contents

Class PrettyMarkupFormatter

Namespace
AngleSharp.Html
Assembly
AngleSharp.dll

Represents the an HTML5 markup formatter with inserted indents.

public class PrettyMarkupFormatter : HtmlMarkupFormatter, IMarkupFormatter
Inheritance
PrettyMarkupFormatter
Implements
Inherited Members
Extension Methods

Constructors

PrettyMarkupFormatter()

Creates a new instance of the pretty markup formatter.

public PrettyMarkupFormatter()

PrettyMarkupFormatter(IEnumerable<INode>)

Creates a new instance of the pretty markup formatter, along with nodes where formatting of text shall be ignored

public PrettyMarkupFormatter(IEnumerable<INode> preserveTextFormatting)

Parameters

preserveTextFormatting IEnumerable<INode>

Nodes in which the structure of the text content should be preserved

Properties

Indentation

Gets or sets the indentation string.

public string Indentation { get; set; }

Property Value

string

NewLine

Gets or sets the newline string.

public string NewLine { get; set; }

Property Value

string

Methods

CloseTag(IElement, bool)

Formats closing a tag with the given name.

public override string CloseTag(IElement element, bool selfClosing)

Parameters

element IElement

The element to close.

selfClosing bool

Is the element actually self-closing?

Returns

string

The formatted closing tag.

Comment(IComment)

Formats the given comment.

public override string Comment(IComment comment)

Parameters

comment IComment

The comment to stringify.

Returns

string

The formatted comment.

Doctype(IDocumentType)

Formats the given doctype using the name, public and system identifiers.

public override string Doctype(IDocumentType doctype)

Parameters

doctype IDocumentType

The document type to stringify.

Returns

string

The formatted doctype.

OpenTag(IElement, bool)

Formats opening a tag with the given name.

public override string OpenTag(IElement element, bool selfClosing)

Parameters

element IElement

The element to open.

selfClosing bool

Is the element actually self-closing?

Returns

string

The formatted opening tag.

Processing(IProcessingInstruction)

Formats the given processing instruction using the target and the data.

public override string Processing(IProcessingInstruction processing)

Parameters

processing IProcessingInstruction

The processing instruction to stringify.

Returns

string

The formatted processing instruction.

Text(ICharacterData)

Formats the given text.

public override string Text(ICharacterData text)

Parameters

text ICharacterData

The text to sanitize.

Returns

string

The formatted text.