jdrouet / mrml

Implementation of mjml in rust
MIT License
322 stars 19 forks source link

Allow HTML boolean attributes #318

Open clj opened 11 months ago

clj commented 11 months ago

The following example, using a boolean attribute on the <ol> tag (see: docs at MDN and WHATWG ), does not work:

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text>
          <ol reversed>
            <li>Second</li>
            <li>First</li>
          </ol>
        </mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Boolean attributes can be expressed in some other ways, to work around this, the following work:

 <ol reversed="">
 <ol reversed="reversed">

and these don't:

 <ol reversed>
 <ol reversed=reversed>

The former are valid XML the latter not, which may explain things (see: https://github.com/jdrouet/mrml/issues/221)

This is also the case in <mj-raw> tags, which is where I am actually trying to use a tag with a boolean attribute. I can obviously work around it, but this behaviour is inconsistent with the mjml.io implementation.

jdrouet commented 11 months ago

Thanks for your feedback! Right now, this issue seems to be related to the xmlparser used under the hood. I'm considering forking it to adapt it to html. But for now, I'll keep this bug open but I don't consider it a priority for now.

clj commented 11 months ago

Thanks for having a look! I agree that this one is fairly low priority and easily worked around. It also generates an error, so easy to detect as well. A future fix would still be great of course!