| Crates.io | prejsx |
| lib.rs | prejsx |
| version | 0.1.0 |
| created_at | 2025-10-12 09:49:15.125446+00 |
| updated_at | 2025-10-12 09:49:15.125446+00 |
| description | A JSX-to-HTML transpiler written in Rust using pest and meval. |
| homepage | |
| repository | https://github.com/Pjdur/prejsx |
| max_upload_size | |
| id | 1879115 |
| size | 16,603 |
prejsx is a lightweight JSX-to-HTML transpiler written in Rust. It parses JSX-like syntax and outputs valid HTML, including support for embedded expressions and inline styles — all without relying on JavaScript or a browser.
{1 + 2}className to class for HTML compatibilitystyle={{color: "red"}}) to CSSAdd this to your Cargo.toml:
[dependencies]
prejsx = "0.1"
use prejsx::render;
fn main() {
let input = r#"<h1 className="title" style={{color: "blue"}}>Hello {2 * 2}!</h1>"#;
let html = render(input);
println!("{}", html);
}
Output:
<h1 class="title" style="color: blue;">Hello 4!</h1>
pest and defined in jsx.pest.{3 + 3} are evaluated using prejsx_math, a zero-dependency math parser.Run the test suite:
cargo test
Example tests include:
prejsx is part of a Cargo workspace:
prejsx-workspace/
├── prejsx/ # JSX-to-HTML transpiler
├── prejsx_math/ # Math expression parser
You can use prejsx_math independently if you need a lightweight math evaluator.
Licensed under either of:
Feel free to open issues or PRs. Whether you're using prejsx in a static site generator, a templating engine, or just for fun — we'd love to hear from you!