How to white list class names for Dialect

(Corey Robertson) #1

I’m working on a plugin and have a dialect that will translate



<div class="my-plugin"></div>

but it appears the sanitizer is stripping out the class name.

Do I need to add a Discourse.Markdown.whiteListClass('my-plugin') to the initializer, or where is the proper spot to configure this?

(Kane York) #2

This is the call:

Discourse.Markdown.whiteListTag('div', 'class', 'my-plugin');

(Corey Robertson) #3

@riking I added that to the intialize function in my plugins intializer, and it starts to show properly in the preview window, but after submitting, the cooked response still has the class name sanitized out.

Do I need to do something to set that rule server side somehow? In my plugin.rb or something?

(Kane York) #4

You need to put it in a dialect file and do: