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
+8 -11
View File
@@ -182,17 +182,14 @@ fn registry(state: Arc<ExampleState>) -> HandlerRegistry {
fn all_examples() -> SafeHtml {
// Static `.heml` fragments are lowered by generated code before they join rendered views.
// req: html_safety/001 req: html_safety/002 req: component/003
SafeHtml::trusted(
[
counter::lower(include_str!("../templates/counter.heml")),
todos::lower(include_str!("../templates/todos.heml")),
wizard::lower(include_str!("../templates/wizard.heml")),
auth::lower(include_str!("../templates/auth.heml")),
render_page_swap("Welcome", "Welcome").into_string(),
notifications::lower(include_str!("../templates/notifications.heml")),
]
.join("\n"),
)
SafeHtml::join([
SafeHtml::trusted(counter::lower(include_str!("../templates/counter.heml"))),
SafeHtml::trusted(todos::lower(include_str!("../templates/todos.heml"))),
SafeHtml::trusted(wizard::lower(include_str!("../templates/wizard.heml"))),
SafeHtml::trusted(auth::lower(include_str!("../templates/auth.heml"))),
render_page_swap("Welcome", "Welcome"),
SafeHtml::trusted(notifications::lower(include_str!("../templates/notifications.heml"))),
])
}
fn shell(body: SafeHtml) -> SafeHtml {