Elements are not self-closing
How can we reproduce this bug?
Use a self-closing element in your email, such as <hr />. Note that the default layout contains such elements in form of link and meta in the head element. Compile the email.
What did you expect to happen?
The self-closing element should end with />, since the doctype is xhtml.
What happened instead?
The self-closing elements are not closed according to the xhtml specification. Both <hr>, <hr/> and <hr /> end up as <hr> after compilation.
This seems to be an issue with cheerio.
Also see https://github.com/cheeriojs/cheerio/issues/1235 Enabling the xmlMode sould probably resolve this: https://repl.it/repls/SpectacularBigElements
Seems the xmlMode breaks things more than it fixes. This is very problematic.
https://repl.it/repls/WanScratchyResearch
In general the email clients should not have an issue with the markup as they all show the content without any issues.
See https://repl.it/@DanielRuf/QuickJuniorListener for a solution using jsdom.
Relevant: https://github.com/jsdom/jsdom/issues/798#issuecomment-434066640 https://github.com/jsdom/jsdom/issues/1839#issuecomment-299461722