FelixSchwarz / mjml-python

Python implementation for MJML - a framework that makes responsive-email easy
MIT License
73 stars 16 forks source link

Orphans opening tags from HTML `<br>` #14

Closed pcorpet closed 1 year ago

pcorpet commented 3 years ago

From Passport (mailjet's editor) I receive some <br> HTML tags inside mjml-text blobs. In XHTML, those should actually be <br/> and it currently make the mjml-stub library choke.

  1. Should I clean them up before using mjml-stub?
  2. Can I try to fix the lib to accept them?

Note that mjml.io is able to work with those tags https://mjml.io/try-it-live/gb2kuVgCdRn The HTML is generated properly with br tags, there are no errors mentioned. Only the syntax highlighter gets lost.

I'd be in favor of doing 2, but don't want to start before your approval.

FelixSchwarz commented 3 years ago

I briefly tried Python's html.parser which should be able to handle entities and & but I did not have the time to build a proof of concept.

So it might be a bit bigger project to solve this entirely but I don't want to burden you with that. A relatively clean workaround/change with lxml would be fine as well.

If you like we can also chat about this.

pcorpet commented 3 years ago

I think that Javascript version of MJML built a dedicated MJML parser. I'm not sure we want to go that far. I'll try a workaround. Thanks