Table of Contents

Class HtmlMarkupFormatter

Namespace
AngleSharp.Html
Assembly
AngleSharp.dll

Represents the standard HTML5 markup formatter.

public class HtmlMarkupFormatter : IMarkupFormatter
Inheritance
HtmlMarkupFormatter
Implements
Derived
Inherited Members
Extension Methods

Constructors

HtmlMarkupFormatter()

public HtmlMarkupFormatter()

Fields

Instance

An instance of the HtmlMarkupFormatter.

public static readonly IMarkupFormatter Instance

Field Value

IMarkupFormatter

Methods

Attribute(IAttr)

Creates the string representation of the attribute.

protected virtual string Attribute(IAttr attr)

Parameters

attr IAttr

The attribute to serialize.

Returns

string

The string representation.

CloseTag(IElement, bool)

Formats closing a tag with the given name.

public virtual 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 virtual 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 virtual string Doctype(IDocumentType doctype)

Parameters

doctype IDocumentType

The document type to stringify.

Returns

string

The formatted doctype.

EscapeText(string)

Escapes the given text by replacing special characters with their HTML entity (amp, nobsp, lt, and gt).

public static string EscapeText(string content)

Parameters

content string

The string to alter.

Returns

string

The altered string.

GetIds(string, string)

Gets the doctype identifiers from the given public and system identifier.

public static string GetIds(string publicId, string systemId)

Parameters

publicId string

The public identifier.

systemId string

The system identifier.

Returns

string

The combined string representation.

LiteralText(ICharacterData)

Emits the text literally.

public virtual string LiteralText(ICharacterData text)

Parameters

text ICharacterData

The text to return.

Returns

string

The contained text.

OpenTag(IElement, bool)

Formats opening a tag with the given name.

public virtual 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 virtual 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 virtual string Text(ICharacterData text)

Parameters

text ICharacterData

The text to sanitize.

Returns

string

The formatted text.

XmlNamespaceLocalName(string)

Gets the local name using the XML namespace prefix if required.

public static string XmlNamespaceLocalName(string name)

Parameters

name string

The name to be properly represented.

Returns

string

The string representation.