feat(core): join safe html fragments

Let already-safe fragments compose without downgrading to String, and use it in the v0 page assembly example to keep rendered and lowered fragments typed at the boundary.

req: html_safety/001

req: html_safety/002

req: component/003
This commit is contained in:
slhx agent
2026-06-01 23:49:20 +02:00
parent fd5d48d59a
commit 117eb57179
4 changed files with 35 additions and 12 deletions
+12
View File
@@ -93,6 +93,18 @@ fn slot_html_requires_explicit_safe_html() {
assert_eq!(payload, Payload::Html(String::from("<strong>ok</strong>")));
}
#[test]
fn safe_html_joins_only_explicit_safe_fragments() {
// req: html_safety/001 req: html_safety/002
let html = SafeHtml::join([
SafeHtml::trusted("<main>"),
SafeHtml::trusted("<strong>ok</strong>"),
SafeHtml::trusted("</main>"),
]);
assert_eq!(html.as_str(), "<main><strong>ok</strong></main>");
}
#[test]
fn param_names_format_generated_param_names() {
// req: codegen/003