aboutsummaryrefslogtreecommitdiff
path: root/typst/src/lib.rs
blob: 5d9dcc4fc1a9d53b074e8f8f00ae2f71ba97b85c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Based on https://github.com/zeon256/minimal-typst-svg-renderer

use typst::layout::PagedDocument;
use typst_svg::svg_frame;

use crate::world::MinimalWorld;

mod world;

pub fn compile() {
    let content = include_str!("../../template.typ");
    let world = MinimalWorld::new(content);

    let res = typst::compile::<PagedDocument>(&world);

    if !res.warnings.is_empty() {
        eprintln!("Warnings: {:?}", res.warnings);
    }

    let doc = res.output.expect("Error compiling typst");

    let svg = svg_frame(&doc.pages[0].frame);
    println!("{}", svg)
}