Filtering of HTML

I am working on WYSIWYG editor for Zammad Knowledgebase and it seems like Zammad is filtering out <span> elements. Can anyone confirm and shed some light on where this happens / how it can be overridden?

This is done by Zammads Sanitizer.
Most of the relevant parts, in theory, life here:

however, please note that you should be super careful with adjusting this part of Zammad, because many sanitizings are there for specific reasons to ensure that your Zammad keeps on running.

1 Like

Agreed! Sanitization is very important!

I found the configuration file which dictates what’s allowed, and I see that span and span>style>color is already whitelisted. So this example for red text should work, but the span tag gets stripped out; any ideas?

<div contenteditable="true" id="396033_translation::content::body" data-name="translation::content::body" class="richtext-content ">
<p><span style="color:red;">This is RED text!</span></p>
</div>

You’re proberbly looking at develop code. If you’re instance is using stable code (which I suggest to do!) it won’t work. Wait for the next Zammad release or switch to develop (not recommended)

1 Like