Comments (12)
Hello,
This is a bug, mj-raw
, shouldn't parse anything in it's node. I'm looking into it, i'll keep you updated.
The mso table ensure that outlook will have a centered 600px table rendered from mj-body
so it's not really optional
from mjml.
I'm sorry @stepanh I don't think i'll have a fix for today.
We have an issue with a dependencies lib called cheerio that rely on htmlparser2. Htmlparser2 is parsing your mj-raw
's content as a tag so that's why you get that weird render.
I try to play with htmlparser2 to see if I can find a quick workaround
from mjml.
Thanks, @iRyusa !
from mjml.
@stepanh sorry for the delay, this was harder than I thought.
Next version of MJML will now correctly render <mj-raw><% if (undefined) {} %></mj-raw>
! I'll keep you updated tomorrow.
from mjml.
I just ran into this issue trying to render handlebars template markup into some mjml output.
from mjml.
@techdragon it's merged on master, will be released it asap sorry for the delay
from mjml.
Having the same problem with <mj-raw>
and PHP tags, I silentely followed this issue.
Recent merge solved the problem for me, my PHP tags are now well-preserved inside a <mj-raw>
A big thank you for this fix @iRyusa ! Also for making email development fun again ;)
from mjml.
We still have incorrect rendering problems for mj-raw in beta8... I'm tempted to say they are worse now, since its generating asymmetrical tags that will really screw up rendering in IE. It looks like the end table tag is actually slipping down to before the next raw element.
<mj-raw>
{{#if advert_1}}
{{#with advert_1}}
</mj-raw>
<mj-section padding-bottom="5" padding-top="5px">
<mj-column><mj-image href='{{link_url}}' src='{{image_url}}'></mj-image></mj-column>
</mj-section>
<mj-raw>
{{/with}}
{{/if}}
</mj-raw>
Turns into
<!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"><tr><td>
<![endif]-->
{{#if advert_1}}
{{#with advert_1}}
<div style="margin:0 auto;max-width:600px;"><table cellpadding="0" cellspacing="0" style="font-size:0;width:100%;" align="center" border="0"><tbody><tr><td style="text-align:center;vertical-align:top;font-size:0;padding:20px 0;padding-bottom:5px;padding-top:5px;"><!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:600px;">
<![endif]--><div aria-labelledby="mj-column-per-100" class="mj-column-per-100" style="vertical-align:top;display:inline-block;font-size:13px;text-align:left;width:100%;"><table cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="font-size:0;padding:10px 25px;" align="center"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="center" border="0"><tbody><tr><td><a href="{{link_url}}" target="_blank"><img alt="" src="{{image_url}}" style="border:none;display:block;outline:none;text-decoration:none;width:100%;height:auto;" width="550" height="auto"></a></td></tr></tbody></table></td></tr></tbody></table></div><!--[if mso]>
</td></tr></table>
<![endif]--></td></tr></tbody></table></div><!--[if mso]>
</td></tr></table>
<![endif]-->
<!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;"><tr><td>
<![endif]-->
{{/with}}
{{/if}}
from mjml.
@techdragon that looks good to me on branch 1.3-beta :
In red body table
In orange raw tags that wrap a section
In blue section + column
In green mj-image
from mjml.
Then I may have misread the logic that constructed the table. It seemed that the opening and closing [if-mso]
comment/tags were generated 'around content', not 'inside containers'. So, using your colours for reference, the orange portion, would belong 'outside' the [if-mso]
segments that are in red.
I could be wrong about the order of nesting however, since all the convoluted table nesting that goes on in an email can make it extremely hard to keep track. Hopefully this comment clears up the question of what I think may still be broken.
from mjml.
Problem is there's many case and we have to deal with :
<mj-body>
<mj-raw>if test</mj-raw>
<mj-section ...Content />
<mj-raw>end iff</mj-raw>
<mj-section ...Content />
</mj-body>
Imagine this scenario, if mso's conditional tags was after the if test
from mj-raw
, the mso structure will not be applied and will completely fail on outlook.
MJML is a markup langage with no logic, you should use a preprocessor before using it for this kind of case.
Mj-raw
is a workaround for some cases but it's not here to fulfill a preprocessor role
from mjml.
Closing this, now behave as expected on 1.3.
from mjml.
Related Issues (20)
- CORS request did not succeed, missing CORS header (mjml/api) HOT 2
- `mjml2html` render in web worker throws `Uncaught ReferenceError: window is not defined` HOT 2
- Support DATA variable in href or button HOT 1
- Icon with text/Column within Column HOT 1
- Dependency: html-minifier REDoS vulnerability HOT 4
- No padding on outlook HOT 8
- Helper UrlEncode does not return the expected result HOT 3
- Empty "lang" attribute on mjml element is rendered as invalid lang="und" HOT 3
- Mobile customization issue. HOT 2
- Example of how to add color variables HOT 1
- MJML Table Data not rendered in newer Outlook versions using WebView2 (Desktop and Android) HOT 14
- how to add a helper container for an image so it can be centered between elements. HOT 1
- Custom mj-head component causes TypeError: this.context.processing is not a function HOT 8
- Outlook 2404 build 17531.20119 not rendering MJML template HOT 10
- MJML Templates not rendering as expected in New Outlook on Windows HOT 4
- Wrong vertical-align in mj-column HOT 1
- Outlook web client doesn't render columns HOT 5
- mjml column is not working in hotmail
- Invalide Certificate HOT 8
- Try it live does not allow pasting HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjml.