Skip to content

Instantly share code, notes, and snippets.

@sorentwo
Created March 7, 2016 16:09
Show Gist options
  • Save sorentwo/6768ba4ffe3a7c0507d1 to your computer and use it in GitHub Desktop.
Save sorentwo/6768ba4ffe3a7c0507d1 to your computer and use it in GitHub Desktop.
Elixir/Phoenix markdown email templates
defmodule MyApp.EmailView do
use MyApp.Web, :view
def render(template, format, %{assigns: assigns}) do
rendered = render_to_string(__MODULE__, template, assigns)
case format do
:text -> rendered
:html -> Earmark.to_html(rendered)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment