long_form_content/
long_form_content.rs1use aetna_core::prelude::*;
14
15fn fixture() -> El {
16 column([
17 h2("Long-form content widgets"),
18 paragraph(
19 "These primitives compose the markdown-shaped vocabulary an \
20 upcoming transformer will target. Each widget is plain \
21 Aetna — selectable text, themed surfaces, the same layout \
22 pass as everything else.",
23 ),
24 h3("Highlights"),
25 bullet_list(vec![
26 text_runs([
27 text("Bulleted lists with a hanging indent — wrapped lines align under "),
28 text("themselves").italic(),
29 text(", not under the marker."),
30 ]),
31 text_runs([
32 text("Inline runs work inside list items: "),
33 text("bold").bold(),
34 text(", "),
35 text("code").code(),
36 text(", "),
37 text("links").link("https://aetna.dev"),
38 text("."),
39 ]),
40 text("Nested blocks live inside an item by composing a column."),
41 ]),
42 blockquote([
43 paragraph(
44 "Markdown's shape is HTML's shape. The Aetna widget kit \
45 already mirrors most of that shape, so the transformer \
46 mostly hands events to existing constructors.",
47 ),
48 paragraph("— Aetna design notes").muted(),
49 ]),
50 h3("Setup steps"),
51 numbered_list(vec![
52 text("Add `aetna-markdown` to the workspace."),
53 text_runs([
54 text("Pull in "),
55 text("pulldown-cmark").code(),
56 text(" with the GFM features the project actually uses."),
57 ]),
58 text("Wire the transformer through the existing widget kit — paragraph, list, blockquote, code_block, divider, table."),
59 ]),
60 h3("Example fenced block"),
61 code_block(
62 "fn render(md: &str) -> El {\n \
63 // pulldown-cmark events -> El\n \
64 todo!(\"phase 2\")\n}",
65 ),
66 ])
67 .gap(tokens::SPACE_4)
68 .padding(tokens::SPACE_7)
69 .width(Size::Fixed(640.0))
70}
71
72fn main() -> std::io::Result<()> {
73 let mut root = fixture();
74
75 let viewport = Rect::new(0.0, 0.0, 640.0, 720.0);
76 let bundle = render_bundle(&mut root, viewport);
77
78 let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
79 let written = write_bundle(&bundle, &out_dir, "long_form_content")?;
80 for p in &written {
81 println!("wrote {}", p.display());
82 }
83
84 if !bundle.lint.findings.is_empty() {
85 eprintln!("\nlint findings ({}):", bundle.lint.findings.len());
86 eprint!("{}", bundle.lint.text());
87 }
88
89 Ok(())
90}