1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! A [`typst::World`] for embedding the Typst compiler in an application.
//!
//! - [`Fonts`]: Typst's bundled fonts, in-memory fonts, system fonts and font
//! directories. Fonts on disk are read only when a document uses them.
//! Build once, share between compilations.
//! - [`EmbeddedWorld`]: the main source, in-memory files, root directories
//! searched in order, `sys.inputs`, a fixed date for reproducible output
//! and, with the `packages` feature, `@preview` and `@local` packages.
//!
//! On `wasm32` there is no filesystem: only fonts and files given as data
//! are available, and `datetime.today()` needs a creation timestamp.
//!
//! ```
//! # #[cfg(feature = "typst-fonts")] {
//! use std::sync::Arc;
//! use embedded_typst::{EmbeddedWorld, Fonts};
//! use typst::syntax::VirtualPath;
//!
//! let fonts = Arc::new(Fonts::builder().typst_fonts().build());
//! let main = VirtualPath::new("main.typ").unwrap();
//! let world = EmbeddedWorld::new(main, "#import \"lib.typ\": greet\n#greet", fonts)
//! .with_creation_timestamp(0);
//! world.add_file(VirtualPath::new("lib.typ").unwrap(), b"#let greet = [Hello]".to_vec());
//!
//! let document = typst::compile::<typst_layout::PagedDocument>(&world)
//! .output
//! .expect("compiles");
//! assert_eq!(document.pages().len(), 1);
//! # }
//! ```
pub use ;
pub use Packages;
pub use Dependency;
pub use ;