# What are the different ways to customize content inside a post (custom attributes and such)

**URL:** https://meta.discourse.org/t/what-are-the-different-ways-to-customize-content-inside-a-post-custom-attributes-and-such/226747
**Category:** Support
**Created:** [May 11, 2022, 11:10am UTC](https://meta.discourse.org/t/what-are-the-different-ways-to-customize-content-inside-a-post-custom-attributes-and-such/226747 "2022-05-11T11:10:01Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 17, 2022, 9:46pm UTC](https://meta.discourse.org/t/what-are-the-different-ways-to-customize-content-inside-a-post-custom-attributes-and-such/226747/6 "2022-05-17T21:46:18Z")

</div>

> [@SaraDev](#):
>
> To add classes to the white-list you **must** use a plugin, the sanitization happens server side as well as client side. Check out [  
> Whitelisting HTML tags / attributes ](https://meta.discourse.org/t/whitelisting-html-tags-attributes/159653) for some details on where to add the whitelisted attributes, ~~and I believe it would look similar to something like this: [Discourse HTML Whitelist](https://github.com/pnewell/discourse-html-whitelist)~~

Thanks for your reply!

I stumbled upon your first link this afternoon.

The github link files are 7 years old so I suppose the code might be outdated?

Anyway, I used this:

```js
export function setup(helper) {
    if (!helper.markdownIt) { return; }
  
    helper.registerOptions((opts, siteSettings) => {
      opts.features.nolinkify = siteSettings.no_linkify_enabled;
    });
  
    helper.allowList(["span.nolinkify"]);
}

```

Which I borrowed from [GitHub - unfoldingWord/discourse-mermaid: Adds the Mermaid JS library to discourse · GitHub](https://github.com/unfoldingWord-dev/discourse-mermaid)

There are only a few lines of code in my plugin and I don’t really know what it’s doing and if all is needed, but at least I can add spans with a `nolinkify` class.

In my case, the purpose was to easily “unlinkify” words in posts with [Auto-Linkify Words](https://meta.discourse.org/t/linkify-words-in-post/82193) (it only accepts tags and classes to prevent linkification), and especially words in titles HTML tags while using [DiscoTOC - automatic table of contents](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143)

I also tried a bbcode syntax based solution like this:

```js
    helper.registerPlugin(md => {
      md.inline.bbcode.ruler.push("nolinkify",{
        tag: "nolinkify",
  
        replace: function(state, tagInfo, content) {
          const token = state.push("html_raw", '', 0);
          const escaped = state.md.utils.escapeHtml(content);
          token.content = `<span="nolinkify ">${escaped}</span>`;
          return true;
        }
      });
    });

```

So, I tried both solutions for my title tags problem with the table of content.  
This doesn’t work:

```xml
## [nolinkify]test[/nolinkify]

```

But this works:

```xml
## <span class="nolinkify">test</span>

```

I’d have preferred the first syntax, but I guess it’s incompatible with the table of content because of the scripts’ order of executions…

---

_[View the full topic](https://meta.discourse.org/t/what-are-the-different-ways-to-customize-content-inside-a-post-custom-attributes-and-such/226747)._
