PreMailer.Net icon indicating copy to clipboard operation
PreMailer.Net copied to clipboard

MoveCssInline is HTML encoding CSS

Open elylv opened this issue 2 years ago • 2 comments

I have my HTML content in a string, and my CSS content in another string. I call PreMailer.MoveCssInline(content, css: csscontent) but the output seems to be HTML encoding certain things from the CSS, for example, my CSS has this line: font-family: "Roboto", sans-serif; which gets outputted as this: <p style="font-family: &quot;Roboto&quot;,sans-serif"></p>

I could move everything to single quotes, which it seems to handle, but it seems like using a hammer to crack a nut (and my CSS preprocessor/minimizer seems to output with double quotes anyway).

elylv avatar May 25 '22 20:05 elylv

Seems to be a result of AngleSharp's HTML output, which in isolation does the right thing; you'd end up with double quotes inside the attribute which is surrounded by double quotes: style="font-family: "Roboto"..."

Why put a single-word font name in quotes, though?

martinnormark avatar May 25 '22 21:05 martinnormark

Apparently, Outlook's HTML renderer requires web fonts to have quotes round them or it doesn't pick up that they're web fonts. Go figure.

elylv avatar May 25 '22 21:05 elylv