-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat request for posthtml-mso #1
Comments
Additional context: It's common when coding HTML emails to use 'ghost tables' for Outlook - this is markup written inside conditional comments that target Outlook on Windows, so that it gets used only in that email client. The most frequent usage is to define fixed-width tables for Outlook when coding mobile-first emails - a technique also known as 'hybrid' in email coding. The problem with the parser right now is that it automatically closes any unclosed tag it encounters, making it impossible to use posthtml-mso for hybrid emails. Basically this: <outlook><table><tr><td></outlook>
<div>Example</div>
<outlook></td></tr></table></outlook> Is output like this: <!--[if mso|ie]><table><tr><td></td></tr></table><![endif]-->
<div>Example</div> Notice also how So the correct output would actually be: <!--[if mso|ie]><table><tr><td><![endif]-->
<div>Example</div>
<!--[if mso|ie]></td></tr></table><![endif]--> |
I think this proposal is good. But I strongly belive that the core posthtml libraries ( I would prefer to something like this in let me know. I may miss something. |
Agree 100%. Not sure how this would be done exactly, but basically what this needs is the unparsed contents of a tag that PostHTML touches - makes sense? |
still a bit lacking. can you give some more details. ? you meant those thing which are not in AST? |
At the moment, I am of the same opinion since something similar ( |
For now, move it to |
@Scrum can we support officially a way to override the renderer like it is done for parser ? @cossssmin it might be an overhead to implement here instead of |
I don't see any reason why we shouldn't do this, and what do you think is missing in the current render ? |
as of now, I couldn't see anything missing. but for cases like this issue, it would be better to have an option. just to increase flexibility. developers can write their own renderer from scratch if they need or they can extend the current one which is done by |
The decisions made in But I like the idea of allowing users to set their parser or be able to expand the current |
Thoughts for implementation
<outlook><div></outlook>
<outlook type="open"><div><outlook type="close"> thereby we get a tree [
{
tag: "outlook",
attrs: {type="open"},
content: [
{
tag: "div",
content: [
{
tag: "outlook",
attrs: {type="close"}
}
]
}
]
}
]
[
{
tag: false,
attrs: {},
content: [
'<!--[if mso|ie]>',
{
tag: "div",
content: [
{
tag: false,
attrs: {},
content: [
'<![endif]-->'
]
}
]
}
]
}
]
<!--[if mso|ie]><div><![endif]--></div> As far as you remember, there is now access to |
I would definitely not want to force the user into defining opening/closing tags through At point 3) the desired output would be
But I suppose I can remove everything after the closing endif 👍 |
The notation remains the same for the user, and all the magic described above happens inside. |
@cossssmin All attempts were in vain, the absence of a closing tag takes the tree deeper, its presence makes all the content content. |
@cossssmin Hi, what was the reason to close this issue? |
Based on your previous comment - if we can still tackle this, my bad 😬 |
We can, I will try to allocate time for this. |
@cossssmin Hi, I think it's worth trying the new option using for |
Getting back to this after a while, this seems to do it for opening tags: node.content = `<!--[if mso]>${tree.render(node.content, {
singleTags: ['table', 'tr', 'td'],
})}<![endif]-->`
return node ... however it doesn't work on something like this because there is no <outlook>
</td></tr></table>
</outlook> Not sure what can be done here, @Scrum any ideas? |
Need to use it in
posthtml-mso
, so this:results in this:
<!--[if mso|ie]><table><tr><td><![endif]-->
and not in this:
<!--[if mso|ie]><table><tr><td></td></tr></table><![endif]-->
The text was updated successfully, but these errors were encountered: