jdrouet/mrml

<mj-font> tag not valid anymore?

paulgoetze opened this issue · 5 comments

Hey @jdrouet, I was updating the Elixir mjml_nif package to use mrml v2.1.1 and saw an issue with rendering previously valid MJML templates that included an <mj-font> tag. (Also see adoptoposs/mjml_nif#119)

It looks like if I remove the <mj-font> tag from the template and instead pass the fonts render option, then rendering works again as expected.

Is the <mj-font> tag not handled anymore in v2.1.1 or should either way of configuring fonts in the MJML template work?

it should, I'll take a look at that, thanks for noticing!

After looking at it, <mj-font {...attrs} /> is the expected behavior. But I can add the behavior for <mj-font {...attrs}></mj-font>.

@jdrouet Ooh, alright. I just checked again with the self-closing tag and it looks like the issue is how the Elixir template engine renders an embedded template: It turns <mj-font ... /> into <mj-font ...></mj-font> (phoenixframework/phoenix_live_view#1596), which is now an invalid format when passed to mrml.

Is there other self-closing tags that are handled similarily? I could see e.g. <mj-divider /> and <mj-image /> work and do not throw errors, even though they got changed to <mj-divider ...></mj-divider> and <mj-image ...></mj-image> respectively in Elixir before passing it to mrml.

That's weird, mj-image and mj-divider are implemented exactly the same way 🤔

That was amazingly fast! Thanks, Jérémie, for the fix and all the good work you put into mrml! ❤️