Open rctyler opened 9 years ago
Given it’s not valid HTML, it’s probably going to be easier just to post-process the HTML to find and replace the comments.
From: rctyler [mailto:notifications@github.com] Sent: 06 June 2015 02:13 To: jamietre/CsQuery Subject: [CsQuery] Downlevel-revealed conditional comments incorrectly modified (#190)
I have the job of building html emails that look great across multiple email clients. Microsoft Outlook usually gives me a lot of trouble, but one way to get around certain caveats with that client is through conditional comments. I particularly need these conditional comments to be in the form of <![if !mso]> and <![endif]> (see http://esd.io/blog/html-email-buttons-conditional-comments.html). I use Premailer.Net to inline my CSS styles, which uses CsQuery in turn. The problem is that those conditional comments are not valid html comments (intentionally so), and CsQuery is modifying them to and . This subtle change unfortunately breaks html emails in Outlook.com. Are there any workarounds?
— Reply to this email directly or view it on GitHubhttps://github.com/jamietre/CsQuery/issues/190.
[cid:image9ed4b2.GIF@03459572.478588c0]
25 Berkeley Square London | W1J 6HN
Ben Jury
Tel: +44 (0) 20 7268 7821 Email: ben.jury@amius.commailto:ben.jury@amius.com Web: www.amius.comhttp://www.amius.com
This email has been scanned for email related threats and delivered safely by Mimecast.
@BenJury, thanks for the response. That is currently what I'm having to do...I don't prefer the post processing, but in my case it doesn't add to much complexity to the code base so I'm fine with it. However, it would be nice if there was a way to ignore conditional comments when enforcing validity.
I have the job of building html emails that need to look great across multiple email clients. Microsoft Outlook usually gives me a lot of trouble, but one way to get around certain caveats with that client is through conditional comments. I particularly need these downlevel-revealed comments to be in the form of
<![if !mso]>
and<![endif]>
(see http://esd.io/blog/html-email-buttons-conditional-comments.html). I use Premailer.Net to inline my CSS styles, which uses CsQuery in turn. The problem is that those conditional comments are not valid html comments (intentionally so), and CsQuery is modifying them to<!--[if !mso]-->
and<!--[endif]-->
. This subtle change unfortunately breaks html emails in Outlook.com. Are there any workarounds? The piece of code in question is here: https://github.com/jamietre/CsQuery/blob/master/source/CsQuery/Output/OutputFormatterDefault.cs#L435