Skip to main content

HtmlSerializerOptions Class

Definition

Assembly:Avalonia.Controls.Documents.Serialization.Html
Package:Avalonia.Controls.Documents.Serialization.Html

Configuration options for Avalonia.Controls.Documents.Serialization.Html.HtmlSerializer. Immutable after construction.

public class HtmlSerializerOptions

Inheritance: object -> HtmlSerializerOptions

Constructors

NameDescription
HtmlSerializerOptions (2 overloads)Initializes options with no custom tag handlers.

HtmlSerializerOptions overloads

HtmlSerializerOptions Constructor

Initializes options with no custom tag handlers.

public HtmlSerializerOptions()

HtmlSerializerOptions Constructor

public HtmlSerializerOptions(System.Collections.Generic.IReadOnlyDictionary<string, Avalonia.Controls.Documents.Serialization.Html.IHtmlTagHandler> tagHandlers)
Parameters

tagHandlers System.Collections.Generic.IReadOnlyDictionary<string, Avalonia.Controls.Documents.Serialization.Html.IHtmlTagHandler>

Properties

NameDescription
BaseFontSizeBase font size in DIPs used for heading scale calculations. Defaults to 14.0 (matching Avalonia's default font size).
DocumentShared serializer options common to all document serializers. HTML import reads Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.MaxImageBytes from it, which caps the payload a data: image source may decode to.
PreserveUnknownTagContentWhen true (default), unrecognized tags are silently consumed and their text content is preserved. When false, unrecognized tags and their content are dropped.
TagHandlersCustom tag handlers keyed by tag name (case-insensitive). Built-in tags are processed first; custom handlers are only consulted for tags not handled by the built-in mapping.

BaseFontSize Property

Base font size in DIPs used for heading scale calculations. Defaults to 14.0 (matching Avalonia's default font size).

public double BaseFontSize { get; set; }

Document Property

Shared serializer options common to all document serializers. HTML import reads Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions.MaxImageBytes from it, which caps the payload a data: image source may decode to.

public Avalonia.Controls.Documents.Serialization.DocumentSerializerOptions Document { get; set; }

PreserveUnknownTagContent Property

When true (default), unrecognized tags are silently consumed and their text content is preserved. When false, unrecognized tags and their content are dropped.

public bool PreserveUnknownTagContent { get; set; }

TagHandlers Property

Custom tag handlers keyed by tag name (case-insensitive). Built-in tags are processed first; custom handlers are only consulted for tags not handled by the built-in mapping.

public System.Collections.Generic.IReadOnlyDictionary<string, Avalonia.Controls.Documents.Serialization.Html.IHtmlTagHandler> TagHandlers { get; set; }

Fields

NameDescription
DefaultDefault options with no custom tag handlers.

Default Field

Default options with no custom tag handlers.

public Avalonia.Controls.Documents.Serialization.Html.HtmlSerializerOptions Default