# Whitelisting elements in Discourse Plugin

**URL:** <https://meta.discourse.org/t/whitelisting-elements-in-discourse-plugin/109727>\
**Category:** Development\
**Created:** [21 בפברואר,‏ 2019,‏ 7:23am UTC](https://meta.discourse.org/t/whitelisting-elements-in-discourse-plugin/109727 "2019-02-21T07:23:30Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![timuism](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/timuism/32/112096_2.png) [@timuism](https://meta.discourse.org/u/timuism)\
**Post date:** [21 בפברואר,‏ 2019,‏ 7:23am UTC](https://meta.discourse.org/t/whitelisting-elements-in-discourse-plugin/109727/1 "2019-02-21T07:23:30Z")

</div>

Hello! I’m super new to discourse, but I am trying to make a plugin that basically creates a bunch of markdown rules. I am using [Developer’s Guide to Markdown Extensions](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023) as well as the [discourse-markdown/quotes.js.es6](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/discourse-markdown/quotes.js.es6) for guidance.

My goal is to make a rule that creates a wrap: `<div class="callout callout--dashed>…</div>`. My problem is that whenever I add a 2nd class to an element. It stops assigning any classes to it.

Here is my code:

```javascript
const rulesForCallout = {
  tag: 'callout',
  before: function(state, tagInfo) {
    let token = state.push('div_open', 'div', 1);
    token.attrs = [];
    token.attrs.push(['class', 'callout callout--dashed']);
  },
  after: function(state) {
    state.push('div_close', 'div', -1);
  }
};

export function setup(helper) {
  if(!helper.markdownIt) { return; }

  helper.whiteList(['div.callout']);

  helper.registerPlugin( md => {
    md.block.bbcode.ruler.push("callout", rulesForCallout);
  });
}

```

I have done `console.log(token.attrs)` which returns what I’d expect: ( `[['class', 'callout callout--dashed']]` ). So I am thinking maybe I am not whitelisting properly?

Any help would be much appreciated. Thank you!

---

_[View the full topic](https://meta.discourse.org/t/whitelisting-elements-in-discourse-plugin/109727)._
