Skip to content

Commit

Permalink
doc: add python usage
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
  • Loading branch information
jdrouet committed Mar 19, 2024
1 parent 5bed074 commit 9811d38
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/mrml-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@
//! # })
//! ```
//!
//! ## Using `mrml` in Python
//!
//! This crate can also be used in Python. The crate is available with pypi and
//! you can find some documentation [here](https://pypi.org/project/mrml/).
//!
//! ```python
//! import mrml
//!
//! # without options
//! result = mrml.to_html("<mjml></mjml>")
//! assert result.startswith("<!doctype html>")
//!
//! # with options
//! parser_options = mrml.ParserOptions(include_loader = mrml.memory_loader({
//! 'hello-world.mjml': '<mj-text>Hello World!</mj-text>',
//! }))
//! result = mrml.to_html("<mjml><mj-body><mj-include path=\"hello-world.mjml\" /></mj-body></mjml>", parser_options = parser_options)
//! assert result.startswith("<!doctype html>")
//! ```
//!
//! # Why?
//!
//! A Node.js server rendering an MJML template takes around **20 MB** of RAM at
Expand Down

0 comments on commit 9811d38

Please sign in to comment.