HtmlSerializerOptions Class
Definition
Configuration options for Avalonia.Controls.Documents.Serialization.Html.HtmlSerializer. Immutable after construction.
public class HtmlSerializerOptions
Constructors
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| BaseFontSize | Base font size in DIPs used for heading scale calculations. Defaults to 14.0 (matching Avalonia's default font size). |
| Document | 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. |
| PreserveUnknownTagContent | When true (default), unrecognized tags are silently consumed and their text content is preserved. When false, unrecognized tags and their content are dropped. |
| TagHandlers | 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. |
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
| Name | Description |
|---|---|
| Default | Default options with no custom tag handlers. |
Default Field
Default options with no custom tag handlers.
public Avalonia.Controls.Documents.Serialization.Html.HtmlSerializerOptions Default