README

bobzhang/html_parser/serializer does not have a README file

#
HtmlContext

pub(all) enum HtmlContext {
Html
JsString
HtmlAttrValue
Url
} derive(Eq,
Debug
)

Output context used by HTML serialization.

Non-Html contexts escape serialized output for embedding in JavaScript strings, HTML attribute values, or URL text.

#
is_void_element

fn is_void_element(name : StringView) -> Bool

Return whether an HTML element is void and must not serialize an end tag.

name is compared against the lowercase HTML void-element set.

#
neutralize_rawtext_end_tag_sequences

fn neutralize_rawtext_end_tag_sequences(value : StringView, tag_name : StringView) -> String

Escape raw-text end-tag openings that would prematurely close tag_name.

Case-insensitive </tag_name sequences followed by >, /, whitespace, or EOF are rewritten by escaping only the < as &lt;. Other text is left unchanged.

#
serialize_start_tag_unchecked

fn serialize_start_tag_unchecked(node :
Node
, quote : Char) -> String

Serialize a start tag without validating element or attribute names.

Attribute values are escaped and may use the requested quote character, but callers must ensure node.name and all attribute names are already safe for serialization. Use the checked serializer path for untrusted names.

#
string_contains_char

fn string_contains_char(value : StringView, needle : Char) -> Bool

Return whether value contains needle.

This scans by Char, so non-BMP characters are treated as single characters even though MoonBit string offsets are UTF-16 code units.

#
to_html

fn to_html(node :
Node
, pretty? : Bool, indent_size? : Int, context? : HtmlContext, quote? : Char) -> String raise
HtmlError

Serialize a node as HTML.

#
to_test_format

fn to_test_format(node :
Node
) -> String

Render a deterministic tree dump intended for conformance tests.

#
to_text

fn to_text(node :
Node
, separator? : String, strip? : Bool, separator_blocks_only? : Bool) -> String

Extract descendant text from a node.

#
write_percent_encoded_byte

fn write_percent_encoded_byte(out : StringBuilder, byte : Byte) -> Unit

Append one byte as an uppercase percent-encoded triplet.

The output form is %HH, using hexadecimal digits 0-9 and A-F.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io