Add more options to control the HTML output
See original GitHub issueIs your feature request related to a problem? Please describe.
MJML strips self-closing tags of the final forward slash (example: <img />
becomes <img>
), both in beautified and non-beautified HTML, and (if I’m not missing something) there’s no way to control this.
Describe the solution you’d like
It would be nice to have an option to control this and other behaviors, such as an argument like --config.stripSlashes=false
or something along those lines.
It would be super cool to have the option to specify the path of a configuration file, something like a .mjmlrc
or mjml-config.json
.
Describe alternatives you’ve considered Right now the only option is to manually modify the outputted HTML.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
The Output element - HTML: HyperText Markup Language
The HTML element is a container element into which a site or app can inject the results of a calculation or the outcome...
Read more >HTML output Tag - W3Schools
Perform a calculation and show the result in an <output> element: ... The <output> tag is used to represent the result of a...
Read more >Class HtmlOutput | Apps Script - Google Developers
append (addedContent), HtmlOutput, Appends new content to the content of ... X-Frame-Options header, which controls clickjacking prevention.
Read more >3.1 HTML document | R Markdown: The Definitive Guide
We recommend that you read this full section before you learn other output formats, because other formats have several features in common with...
Read more >HTML Options - Quarto
fontcolor. Sets the CSS color property. ; linkcolor. For HTML output, sets the CSS color property on all links. For LaTeX output, The...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you guys, it was indeed Juice’s fault, and
juicePreserveTags
did solve the issue. Here’s the config I’ve used, for the sake of completeness and in case anyone stumbles here:--config.juicePreserveTags='{"imgTag": { "start": "<img", "end": "/>" }, "brTag": { "start": "<br", "end": "/>" }}'
Of course you can add as many self-closing tags as you like, contrary to my initial belief the styles will be inlined anyway, and this works even forimg
tags generated bymj-image
.Thank you again, keep up the good work ❤️
Hi @nevnein the inlining is handled by the
juice
library.Right now the only juice option that we expose is
juicePreserveTags
you can see an example in the cli documentation (but you can also use this option when using mjml as a node library) https://github.com/mjmlio/mjml/blob/next/packages/mjml-cli/README.md Maybe it can do the trick