summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-13 15:14:25 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-13 16:04:25 +0100
commitb1b4e52af9e2da8f8ae1fc17a81ed6cbcbb8f525 (patch)
treee97ad140dac6d0414e9b49f7d01abccdcd717d4f /docs
parent72b60dfde751b4a2ab279aa1fcfa559b4a75eb51 (diff)
Block sizing
Diffstat (limited to 'docs')
-rw-r--r--docs/src/html.rs10
-rw-r--r--docs/src/lib.rs2
2 files changed, 6 insertions, 6 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs
index 550e6ff8..9fbb4fd8 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -287,17 +287,17 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html {
let source = Source::new(SourceId::from_u16(0), Path::new("main.typ"), compile);
let world = DocWorld(source);
- let mut frame = match typst::compile(&world, &world.0) {
- Ok(doc) => doc.pages.into_iter().next().unwrap(),
+ let mut frames = match typst::compile(&world, &world.0) {
+ Ok(doc) => doc.pages,
Err(err) => panic!("failed to compile {text}: {err:?}"),
};
if let Some([x, y, w, h]) = zoom {
- frame.translate(Point::new(-x, -y));
- *frame.size_mut() = Size::new(w, h);
+ frames[0].translate(Point::new(-x, -y));
+ *frames[0].size_mut() = Size::new(w, h);
}
- resolver.example(highlighted, frame)
+ resolver.example(highlighted, &frames)
}
/// World for example compilations.
diff --git a/docs/src/lib.rs b/docs/src/lib.rs
index 620aaaaa..c9e7af25 100644
--- a/docs/src/lib.rs
+++ b/docs/src/lib.rs
@@ -67,7 +67,7 @@ pub trait Resolver {
fn image(&self, filename: &str, data: &[u8]) -> String;
/// Produce HTML for an example.
- fn example(&self, source: Html, frame: Frame) -> Html;
+ fn example(&self, source: Html, frames: &[Frame]) -> Html;
}
/// Details about a documentation page and its children.