typst_bake/lib.rs
1//! # typst-bake
2//!
3//! Bake Typst templates, fonts, and packages into your binary for offline PDF generation.
4//!
5//! ## Quick Start
6//!
7//! Add to your `Cargo.toml`:
8//! ```toml
9//! [package.metadata.typst-bake]
10//! template-dir = "./templates"
11//! fonts-dir = "./fonts"
12//!
13//! [dependencies]
14//! typst-bake = "0.1"
15//! ```
16//!
17//! Then use the `document!()` macro:
18//! ```rust,ignore
19//! let pdf = typst_bake::document!("main.typ")
20//! .to_pdf()?;
21//!
22//! std::fs::write("output.pdf", pdf)?;
23//! ```
24
25mod build;
26mod document;
27mod resolver;
28mod stats;
29
30pub use build::rebuild_if_changed;
31pub use document::Document;
32pub use stats::{CategoryStats, EmbedStats, PackageInfo, PackageStats};
33pub use typst_bake_macros::document;
34
35/// Derive macro for implementing `IntoValue` trait.
36pub use typst_bake_macros::IntoValue;
37
38/// Derive macro for adding `into_dict()` method.
39pub use typst_bake_macros::IntoDict;
40
41/// Re-export include_dir for macro-generated code.
42#[doc(hidden)]
43pub use include_dir;
44
45/// Internal module for macro-generated code.
46/// Do not use directly.
47#[doc(hidden)]
48pub mod __internal {
49 pub use super::document::Document;
50 pub use include_dir::Dir;
51 // Re-export include_dir crate for direct struct construction
52 pub use include_dir;
53 // Re-export typst crate for derive macros
54 pub use typst;
55}