typst-2-rsx

Crates.iotypst-2-rsx
lib.rstypst-2-rsx
version0.2.0
created_at2025-02-06 11:51:36.786672+00
updated_at2025-02-09 14:30:06.658487+00
descriptionConvert Typst documents into RSX SVG elements for use in Rust UI development.
homepage
repositoryhttps://github.com/Etase/typst-2-rsx
max_upload_size
id1545436
size1,224,409
Etase (Etase)

documentation

https://docs.rs/typst-2-rsx

README

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

  1. Compiles .typ to .svg using the typst CLI.
  2. Parses the generated .svg file.
  3. Transforms the SVG elements into RSX components.

🛠 Dependencies

  • typst-cli – Required for Typst compilation.
  • dioxus(optional) – For rendering RSX.

📜 License

This project is licensed under MIT OR Apache-2.0.

Commit count: 31

cargo fmt