Problem/Motivation

I want to send an HMTL email that contains an HTML token.
Token HTML contains style attributes which are removed by Drupal core. \Drupal\Core\Render\Markup
How can I return intentional unsafe HTML through tokens?

Steps to reproduce

1. Create a custom token
2. return HTML with style attributes like
<div align="left" class="custom-class" style="font-size: 14px; vertical-align: top; padding-bottom: 15px; color: red;">Hello World</div>
3. Notice that token output will only contain
<div align="left" class="custom-class">Hello World</div>

Proposed resolution

How can I return unsafe/unfiltered HTML through tokens?

Comments

khaldoon_masud created an issue.

andregp’s picture

@khaldoon_masud the maintainers may have a good reason for making the tokens tokens be returned filtered.
Have you tried talking with them about this feature request?
It's easier to reach maintainers through the Drupal slack. I believe you could try there (if you haven't already) to discuss about this feature and see their opinion.