vanng822 / go-premailer

Inline styling for html mail in golang
MIT License
139 stars 19 forks source link

font-family escaping #15

Open pierre-b opened 3 years ago

pierre-b commented 3 years ago

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

vanng822 commented 3 years ago

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 commented 3 years ago

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

But could also be from css-package.

pierre-b commented 3 years ago

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

vanng822 commented 4 months ago

I took a closer look, I think the problem is in net/html, It may related to this proposal. https://github.com/golang/go/issues/43224

goquery just uses html.Attribute and as I could see the value is correct until this point.

pierre-b commented 4 months ago

Thanks for the follow up!