Mjml (mjml v0.3.1) View Source

Provides functions for transpiling MJML email templates to HTML.

Link to this section Summary

Functions

Converts an MJML string to HTML content.

Link to this section Functions

Converts an MJML string to HTML content.

(Passing any options – which the underlying mrml Rust crate already handles – is not yet implemented.)

Returns a result tuple:

  • {:ok, html} for a successful MJML transpiling
  • {:error, message} for a failed MJML transpiling

Examples

iex> Mjml.to_html("<mjml><mj-head></mj-head></mjml>")
{:ok, "<!doctype html><html xmlns=..."}

iex> Mjml.to_html("something not MJML")
{:error, "Couldn't convert MJML template"}