go-premailer icon indicating copy to clipboard operation
go-premailer copied to clipboard

font-family escaping

Open pierre-b opened this issue 4 years ago • 5 comments

Hello guys,

When I check the generated HTML for classes that contain a font-family the output is:

<p class="font-family:&#39;Arial&#39;, sans-serif"></p>

Is this the expected behavior? I'm suprised to see HTML entities &#39; in the middle of a CSS attribute...

Thanks

pierre-b avatar May 18 '21 19:05 pierre-b

Hi @pierre-b

Unfortunately I don't have any development computer anymore so I can't take a look but I think most likely somewhere in html.Nodes that escape the value of attribute.

So for now if possible don't use quotes (I think it is possible for your example but maybe you have other things that need quotes)

vanng822 avatar May 22 '21 08:05 vanng822

Or maybe goquery that use html.Render https://github.com/PuerkitoBio/goquery/blob/master/property.go#L104

But could also be from css-package.

vanng822 avatar May 22 '21 08:05 vanng822

Hi @vanng822 thanks for the update, removing the quotes on standard fonts works (Arial etc...).

pierre-b avatar May 22 '21 09:05 pierre-b