prose
look
Headings, paragraphs, lists, quotes and code.
Drawn
Release notes
The diff is now typed end to end.
- rows keep their place
- forms check as you type
One shape, three renderers.
Row::new("build").value(Shown::Text("2m".into()))The sample
fn words() -> Vec<Block> {
let prose = Prose::new(vec![
heading("Release notes"),
para(vec![span("The diff is now "), bold("typed"), span(" end to end.")]),
Part::List {
ordered: false,
items: vec![
vec![span("rows keep their place")],
vec![span("forms check as you type")],
],
},
Part::Quote {
spans: vec![span("One shape, three renderers.")],
},
listing("rust", "Row::new(\"build\").value(Shown::Text(\"2m\".into()))"),
])
.id("notes");
let chart = Media::new("media/sample.svg", "a bar chart", 640_u32, 360_u32);
let hero = Hero::new("Weekly report")
.id("report")
.subtitle("What moved, what waits, what broke.")
.media(chart.clone())
.actions(vec![Act {
label: "open".into(),
tap: Some(open("gallery.html#kind-hero")),
..Act::default()
}]);
let link = |label: &str| NavLink {
label: label.into(),
href: "gallery.html#kind-nav".into(),
current: (label == "docs").then_some(true),
};
let nav = Nav::new(vec![link("docs"), link("guides"), link("changelog")])
.id("acme-nav")
.brand(link("Acme"));
let shots = ["home", "list", "form", "dark"].map(sample_svg).to_vec();
vec![
b!(Text(Text::new().id("green").markdown(
"**Builds are green.** The last one took `2m 14s`, see https://github.com/jirathip-dev/blocks"
))),
b!(Prose(prose)),
b!(Hero(hero)),
b!(Nav(nav)),
b!(Media(
chart
.id("downloads")
.caption("Downloads by week, 8 weeks, marked up")
.marks(markup())
)),
b!(Images(Images::new(shots).id("shots"))),
b!(Diagram(release())),
]
}{
"blocks": [
{
"fallback": {
"title": "prose"
},
"id": "notes",
"parts": [
{
"level": 2,
"part": "heading",
"spans": [
{
"text": "Release notes"
}
]
},
{
"part": "para",
"spans": [
{
"text": "The diff is now "
},
{
"bold": true,
"text": "typed"
},
{
"text": " end to end."
}
]
},
{
"items": [
[
{
"text": "rows keep their place"
}
],
[
{
"text": "forms check as you type"
}
]
],
"ordered": false,
"part": "list"
},
{
"part": "quote",
"spans": [
{
"text": "One shape, three renderers."
}
]
},
{
"lang": "rust",
"part": "code",
"text": "Row::new(\"build\").value(Shown::Text(\"2m\".into()))"
}
],
"type": "prose"
}
],
"fallback": {
"title": "screen"
},
"id": "prose",
"type": "screen"
}Its fallback
What a renderer without
prose draws: a row from the fallback the block carries.prose
Style hooks
.b-prosethe block
[data-block=prose]every block of the kind
[data-id=notes]this one block
Every page here is a blocks
Screen, written by site::page: no hand-written HTML. Source: https://github.com/jirathip-dev/blocks