Sign in

    mizchi/luna/core/render does not have a README file

    SSRResult

    pub struct SSRResult {
    html : String
    preload_urls : Array[String]
    }

    SSR result with HTML and preload URLs collected from islands

    escape_attr

    fn escape_attr(s : String) -> String

    Escape attribute and return new string

    escape_attr_to

    fn escape_attr_to(sb : StringBuilder, s : String) -> Unit

    Escape attribute value and write to StringBuilder

    escape_html

    fn escape_html(s : String) -> String

    Escape HTML and return new string

    escape_html_to

    fn escape_html_to(sb : StringBuilder, s : String) -> Unit

    Escape HTML special characters and write to StringBuilder

    escape_js_string

    fn escape_js_string(s : String) -> String

    Escape JS string for embedding in script tags Handles injection prevention

    escape_js_string_to

    fn escape_js_string_to(sb : StringBuilder, s : String) -> Unit

    Escape JS string and write to StringBuilder

    escape_json_for_attr

    fn escape_json_for_attr(json : String) -> String

    Escape JSON for safe embedding in HTML attribute values

    Escapes:
    • " -> "
    • & -> &
    • < -> &lt;
    • > -> &gt;

    escape_json_for_script

    fn escape_json_for_script(json : String) -> String

    Escape JSON for safe embedding in HTML tags

    Prevents XSS by escaping:
    • </ -> <\/ (prevents injection)
    • <s / <S -> <\u0073 / <\u0053 (additional safety)

    Reference: https://sophiebits.com/2012/08/03/preventing-xss-json

    generate_preload_tags

    fn generate_preload_tags(urls : Array[String]) -> String

    Generate modulepreload link tags from collected URLs

    is_void_element

    fn is_void_element(tag : String) -> Bool

    Check if HTML tag is a void (self-closing) element

    needs_attr_escape

    fn needs_attr_escape(s : String) -> Bool

    Check if string needs attribute escaping (subset of HTML)

    needs_html_escape

    fn needs_html_escape(s : String) -> Bool

    Check if string needs HTML escaping

    render_attr_value

    fn render_attr_value(sb : StringBuilder, name : String, s : String) -> Unit

    Render a single attribute value

    render_attrs_to

    fn[E, A : Show] render_attrs_to(sb : StringBuilder, attrs : Array[(String,
    Attr
    [E, A])]) -> Unit

    Render attributes to StringBuilder

    render_to_string

    fn[E, A : Show] render_to_string(node :
    Node
    [E, A], preload? : Bool, size_hint? : Int) -> SSRResult

    Render a VNode to HTML string
    • preload: Whether to collect preload URLs from islands (default: false)

    render_to_string_with_hydration

    fn[E, A : Show] render_to_string_with_hydration(node :
    Node
    [E, A], size_hint? : Int) -> String

    Render with data-ssr-id markers for hydration

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io