Html

:= { parsed : Parsed }

HTML documents, fragments and typed literal templates. Strict HTML syntax and authoring checks are the default. Browser recovery is opt-in and retains typed diagnostics beside the repaired tree and exact original source bytes.

parse_str : Str, Props -> Try(Html, [InvalidMarkup(Error)])

Parse and validate a document, retaining recovery diagnostics when enabled.

parse_fragment : Str, Props -> Try(Fragment, [InvalidMarkup(Error)])

Parse one or more roots in the configured fragment context.

validate : ValidationProps -> Try(Html, [InvalidMarkup(Error)])

Validate a complete document for a checked constant or imported file.

from_quote : Str -> Try(Html, [BadQuotedBytes(Str)])

Check a complete HTML literal during compilation.

parse_segments : List(Str), Props -> Try(Plan, [InvalidMarkup(Error)])

Parse fixed segments and explicit text/whole-attribute holes. No textual sentinels are inserted, and structural positions cannot contain holes.

RepairContext

Html.RepairContext :: # (opaque)
child : RepairContext, Name -> Try(RepairContext, [InvalidConstruction(Diagnostic(Problem))])

Check a new child and return its descendant context.

text : RepairContext, Str -> Try({}, [InvalidConstruction(Diagnostic(Problem))])

Check decoded text placement.

Props

:= { parent : Name, scripting : [Enabled, Disabled] ?? Enabled }

Seed a bounded HTML repair context at an explicit parent.

RepairProps

:= { parent : Name, scripting : [Enabled, Disabled] ?? Enabled }

Seed a bounded HTML repair context at an explicit parent.

Props

:= { syntax : Syntax ?? HtmlSyntax, exact_structure : Bool ?? False, strict_foreign_spelling : Bool ?? False, recovery : [Strict, Browser] ?? Strict, allow_unknown_elements : Bool ?? False, allow_unknown_attributes : Bool ?? False, check_values : Bool ?? True, max_source_bytes : U64 ?? 16_777_216, max_depth : U64 ?? 1024, max_elements : U64 ?? 4_194_304, max_nodes : U64 ?? 4_194_304, max_slots : U64 ?? 65_536, max_attributes : U64 ?? 1024, max_diagnostics : U64 ?? 1024, max_work_per_byte : U64 ?? 256, context_namespace : Str ?? "http://www.w3.org/1999/xhtml", context_element : Str ?? "body", scripting : Bool ?? True }

HTML defaults and explicit XML/recovery/validation/fragment-context options. exact_structure requires authored nesting without browser repairs. strict_foreign_spelling requires authored SVG/MathML names to match their canonical DOM spelling in HTML syntax, including closing tags.

ValidationProps

:= { source : Str, name : Str ?? "<literal>", options : Props ?? {} }

Source and diagnostics label for checked imported constants.

SourceProps

:= { mode : [Document, Fragment] ?? Document, options : Props ?? {} }

Syntax-only parsing retains browser tree construction and diagnostics. Use Fragment mode for the configured enclosing element; Document is default.

Fragment

:= { parsed : Parsed }

A fragment preserves all authored roots and source bytes.

validate : ValidationProps -> Try(Fragment, [InvalidMarkup(Error)])

Validate imported fragment text with named diagnostics and options.

from_quote : Str -> Try(Fragment, [BadQuotedBytes(Str)])

Check a fragment literal in the default body context.

single_element : Fragment -> Try(Node, [RootCount(U64)])

Require exactly one element root, ignoring comments/whitespace.

Template

:= { bound : Bound(a) }

A parsed template and its typed bindings Binding performs no source parse.

from_quote : Str -> Try(Template(a), [BadQuotedBytes(Str)])

Parse a static fragment as a template with no holes.

from_interpolation : List(Str) -> Try(Iter(a) -> Template(a), [InvalidInterpolation(Str)])

Validate fixed segments at compile time and capture arbitrary typed bindings through the compiler's Iter-based interpolation assembler.