UL class stripped in topic posts


(Nick Putman) #1

I am importing a Wordpress blog article to discourse using the javascript embed method as described here:.

The html includes a UL with a class defined which I use for custom CSS in WP. I have added the same CSS to the customisation in discourse admin, but the class is getting stripped out when the topic post is rendered. Is there any way of getting the class to stick so that the CSS will be applied?


(Mittineague) #2

Have you tried whitelisting it in a Dialect?

eg. (old code, syntax may have changed)

Discourse.Markdown.whiteListTag("ul", "class", /yourclassnamehere/);

(Nick Putman) #3

No - wasn’t aware that I could do this - how do I go about doing so?


(Mittineague) #4

There may be a way to add the code into Admin -> Customize ?

but a simple 2 file plugin should do it. eg.

https://github.com/McCompetitive/discourse-progressbar


(Nick Putman) #5

Sorry, I’m not sure where to add this in Admin -> Customise and also not sure what to do with the ‘progress bar’ plugin, and how this would help me with the styling.


(Mittineague) #6

I don’t know how to do it in Admin -> Customize or even if it can be done there. - but -

The problem you are having is that Discourse is removing the class value.

I did not mean for you to use the progress plugin, but to use it as a base example of how you could write your own plugin consisting of 2 simple files.

discourse/plugins/
… your-plugin-folder/
… … plugin.rb
… … assets/javascripts/
… … … your-plugin-name.js.es6