I use Thymeleaf for email templates. Since HTML email templates are a bit of a pain in the *ss, I want to declare some values in variables and then use them whenever needed inside the template. For example, you have to put into each style attribute for tags holding text the complete font-family.
So my approach is something like this:
<div th:with="fontFamilySans='font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI Adjusted\', \'Segoe UI\', \'Liberation Sans\', Roboto, \'Helvetica Neue\', Arial, sans-serif;'">
<p th:style="|margin: 0; padding: 0; ${fontFamilySans}|">Aloha from Hawaii</p>
</div>
Unfortunaltely, doing it this way the single quotes get escaped:
<p style="margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI Adjusted', 'Segoe UI', 'Liberation Sans', Roboto, 'Helvetica Neue', Arial, sans-serif;">Aloha from Hawaii</p>
Is there any way to tell Thymeleaf to no escape the quotes but treat them as valid HTML code?
Many thanks for any help