3 unstable releases
new 0.2.0 | Feb 9, 2025 |
---|---|
0.1.1 | Feb 6, 2025 |
0.1.0 | Feb 6, 2025 |
#280 in Images
227 downloads per month
160KB
369 lines
typst-2-rsx
Convert Typst documents (.typ
) into RSX elements as SVG components.
📌 Overview
typst-2-rsx
is a Rust library that automates the conversion of Typst documents into RSX elements. It first uses the typst
CLI to compile .typ
files into .svg
, and then parses the .svg
file into RSX elements, making it easy to integrate Typst-generated content into Rust-based UI frameworks like Dioxus.
🚀 Installation
Using Cargo
cargo add typst-2-rsx
Or manually add to Cargo.toml:
[dependencies]
typst-2-rsx = "0.2.0"
Then run the cargo build to compile.
📖 Usage
use typst_2_rsx::typst_to_rsx;
let rsx_svg = typst_to_rsx("example.typ").expect("Conversion failed");
println!("{}", rsx_svg);
🔧 How It Works
- Compiles
.typ
to.svg
using thetypst
CLI. - Parses the generated
.svg
file. - Transforms the SVG elements into RSX components.
🛠 Dependencies
📜 License
This project is licensed under MIT OR Apache-2.0.
Dependencies
~3–9MB
~82K SLoC