Crates.io | mrml |
lib.rs | mrml |
version | 4.0.1 |
source | src |
created_at | 2020-05-26 15:27:52.121927 |
updated_at | 2024-07-03 18:29:04.36529 |
description | Rust implementation of MJML renderer |
homepage | |
repository | https://github.com/jdrouet/mrml/ |
max_upload_size | |
id | 246249 |
size | 607,013 |
This project is a reimplementation of the nice MJML markup language in Rust.
Update your cargo.toml
:
[dependencies]
mrml = "2"
serde = { version = "1.0", features = ["derive"] }
Create your main.rs
:
use mrml;
fn main() {
let root = mrml::parse("<mjml><mj-body></mj-body></mjml>").expect("parse template");
let opts = mrml::prelude::render::Options::default();
match root.render(&opts) {
Ok(content) => println!("{}", content),
Err(_) => println!("couldn't render mjml template"),
};
}
Available options are:
Name | Comment | Default value |
---|---|---|
disable_comments |
Strip comments out of rendered HTML | false |
social_icon_origin |
Custom URL for fetching social icons | None |
fonts |
Default fonts imported in the HTML rendered by MJML | See default options |
bash script/run-bench.sh
.Feel free to read our contributing section and the code of conduct.
With the same Linux amd64 machine, to render the amario template
mj-style[inline]
: not yet implemented. It requires parsing the generated html to apply the inline styles afterward (that's how it's done in mjml) which would kill the performances. Applying it at render time would improve the performance but it would still require to parse the CSS.mj-include
: not yet implemented. It requires to handle loading remote templates when using mrml in a wasm (browser or server side) format, which implies being able to load from a different location (file://
, https://
, relative, etc).If you are using MRML and want to be added to this list, don't hesitate to create an issue or open a pull request.
mjml_nif - Elixir library
mrml-ruby - Ruby library
mjml-python - Python library
If you are using MRML and want to be added to this list, don't hesitate to create an issue or open a pull request.
Thanks to zachzurn.