jdrouet / mrml

Implementation of mjml in rust
MIT License
317 stars 18 forks source link

Support void (self-closing) HTML elements in mj-raw #432

Open tstriker opened 3 weeks ago

tstriker commented 3 weeks ago

I bumped into this while switching from node version to the python one (which is a port of this lib, i believe).

There is a number of 'void' elements that do not require closing in HTML: https://developer.mozilla.org/en-US/docs/Glossary/Void_element

however, the lib right now seems to be tripping on them with "unexpected end of stream"

the node version does not seem to have a similar limitation, so seems like could be useful to address these void elements.

thank you for the lib!

jdrouet commented 3 weeks ago

Hey, Could you provide an example? I'm already hunting them but some might not be caught by the CI

tstriker commented 2 weeks ago

Updated the bug title as i realized that it is specific to contents of mj-raw. Here's a quick snippet of MJML that triggers the unexpected end of stream:

<mjml>
  <mj-body>
    <mj-raw>
      <img src="bananas">
    </mj-raw>
  </mj-body>
</mjml>