pub struct HtmlRenderer { /* private fields */ }Expand description
A stateless, streaming HTML renderer. Each render call decodes a self-contained snapshot batch into a transient map, walks it once, and streams HTML text out — zero state retained across calls. A pure function of the opcode stream (Renderer Statelessness).
Implementations§
Source§impl HtmlRenderer
impl HtmlRenderer
Sourcepub fn with_debug_comments(self, on: bool) -> Self
pub fn with_debug_comments(self, on: bool) -> Self
Enable/disable debug comments. When on, each rendered node is prefixed
with an HTML comment naming its component and the modifiers applied
(see [crate::debug]).
Sourcepub fn debug_comments(&self) -> bool
pub fn debug_comments(&self) -> bool
Whether debug comments are enabled.
Sourcepub fn render_document(
&self,
opcodes: &[Opcode],
strings: &[u8],
root: u32,
) -> String
pub fn render_document( &self, opcodes: &[Opcode], strings: &[u8], root: u32, ) -> String
Render the subtree rooted at root as a full HTML document, with the
built-in base design inlined as a <style> block (the default for
library hosts and tests).
Sourcepub fn render_document_with_meta(
&self,
opcodes: &[Opcode],
strings: &[u8],
root: u32,
meta: &DocumentMeta,
) -> String
pub fn render_document_with_meta( &self, opcodes: &[Opcode], strings: &[u8], root: u32, meta: &DocumentMeta, ) -> String
Render a full HTML document with host-supplied DocumentMeta
(canonical URL, Open Graph/Twitter tags, JSON-LD) and the built-in base
design inlined as a <style> block.
The renderer stays stateless: meta is input to this call only.
META::SET_WINDOW_METADATA title/description/locale still win over the
fallbacks in meta.
Sourcepub fn render_document_linked(
&self,
opcodes: &[Opcode],
strings: &[u8],
root: u32,
css_base: &str,
) -> String
pub fn render_document_linked( &self, opcodes: &[Opcode], strings: &[u8], root: u32, css_base: &str, ) -> String
Render the subtree rooted at root as a full HTML document with the
built-in base design as a separate content-hashed stylesheet link
({css_base}/{css::builtin_css_name()}) instead of an inline <style>
block. css_base is the host’s reserved framework base (e.g.
/_pathland); an empty base falls back to the inline document.
Token overrides and fit-band rules stay inline (they are per-session renderer state), after the stylesheet link so they win the cascade.
Sourcepub fn render_document_linked_with_meta(
&self,
opcodes: &[Opcode],
strings: &[u8],
root: u32,
css_base: &str,
meta: &DocumentMeta,
) -> String
pub fn render_document_linked_with_meta( &self, opcodes: &[Opcode], strings: &[u8], root: u32, css_base: &str, meta: &DocumentMeta, ) -> String
render_document_linked with
host-supplied DocumentMeta.
Sourcepub fn render_fragment(
&self,
opcodes: &[Opcode],
strings: &[u8],
root: u32,
) -> String
pub fn render_fragment( &self, opcodes: &[Opcode], strings: &[u8], root: u32, ) -> String
Render the subtree rooted at root as an HTML fragment (no <html>).
SET_DESIGN_TOKEN overrides are applied to the document head by
render_document; a fragment is assumed to be embedded in a document
that already defines the token variables.