use std::collections::HashMap; use morgana::{morx, Component, RenderNode}; pub fn main() { let parent = ParentLayout { children: vec![ RenderNode::Component( Box::new(Child { children: vec![ RenderNode::TextNode { content: "Hello world!".to_string() } ] }) ) ] }; let text = morgana::render_tree_blocking(RenderNode::Component(Box::new(parent))); println!("{text}") } struct ParentLayout { children: Vec } impl Component for ParentLayout { fn render(self: Box) -> Vec { let test = morx! { html lang="en-US" { head { title { "test thing" } } body { "some document" } } }; vec![ RenderNode::Element { name: "html".to_string(), attributes: HashMap::from([("lang".to_string(), "en-US".to_string())]), children: vec![ RenderNode::Element { name: "head".to_string(), attributes: HashMap::new(), children: vec![ RenderNode::Element { name: "title".to_string(), attributes: HashMap::new(), children: vec![ RenderNode::TextNode { content: "test thing".to_string() } ] } ] }, RenderNode::Element { name: "body".to_string(), attributes: HashMap::new(), children: self.children, }, ] } ] } } struct Child { children: Vec } impl Component for Child { fn render(self: Box) -> Vec { vec![ RenderNode::Element { name: "p".to_string(), attributes: HashMap::new(), children: self.children } ] } }