Crates.io | mrml-json-macros |
lib.rs | mrml-json-macros |
version | 0.1.4 |
source | src |
created_at | 2023-02-12 19:59:21.674938 |
updated_at | 2024-06-13 17:10:49.525661 |
description | Macros for the JSON feature of the MRML crate |
homepage | |
repository | https://github.com/jolimail/mrml-core/ |
max_upload_size | |
id | 783454 |
size | 22,840 |
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.