# Custom Markdown Content Missing

**URL:** https://meta.discourse.org/t/custom-markdown-content-missing/150458
**Category:** Development
**Created:** [May 5, 2020, 2:41pm UTC](https://meta.discourse.org/t/custom-markdown-content-missing/150458 "2020-05-05T14:41:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)
#### Post date: [May 5, 2020, 2:41pm UTC](https://meta.discourse.org/t/custom-markdown-content-missing/150458/1 "2020-05-05T14:41:58Z")

</div>

I’m trying to create a [fieldset=] bbcode where you can enter a title as the = option and the content inside the tag.  
So far, my rule creates the html tags properly, but the content and option are missing.

This is the tag structure that looks correct:

```plaintext
<fieldset class="bbcode-fieldset">
<legend></legend>
<span></span>
</fieldset>

```

And this is the rule I have added:

```plaintext
md.block.bbcode.ruler.push("fieldset", {
    tag: "fieldset",
    replace: function(state, tagInfo, content) {
      let token = state.push("fieldset_open", "fieldset", 1);
      token.attrs = [["class", "bbcode-fieldset"]];

      token = state.push("legend_open", "legend", 1);
      token.content = tagInfo.attrs['_default'];
      token = state.push("legend_close", "legend", -1);

      token = state.push("span_open", "span", 1);
      token.content = content;

      token = state.push("span_close", "span", -1);
      token = state.push("fieldset_close", "fieldset", -1);

      return true;
    }
  });

```

Is there something I’m missing regarding adding the content and the \_default attribute? I want it to look like this:

```plaintext
<fieldset class="bbcode-fieldset">
<legend>{option}</legend>
<span>{text}</span>
</fieldset>

```

---

<div class="post-metadata">

### Author: ![ledadu](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@ledadu](https://meta.discourse.org/u/ledadu)
#### Post date: [December 15, 2021, 9:29pm UTC](https://meta.discourse.org/t/custom-markdown-content-missing/150458/2 "2021-12-15T21:29:19Z")

</div>

```plaintext
token = state.push("span_open", "span", 1);

// Add this line :
token = state.push('text', '', 0);

token.content = content;
token = state.push("span_close", "span", -1);

```

**Source :**

> [@Custom BBCode Help/Advice](https://meta.discourse.org/t/custom-bbcode-help-advice/84005/3):
>
> tag: 'vote', replace: (state, tagInfo, content) =\> { let token; token = state.push('span\_open', 'span', 1); token.attrs = [['class', 'vote']]; token = state.push('text', '', 0); token.content = 'VOTE:' + content; token = state.push('span\_close', 'span', -1); return true; }, }); Basically did this and defined a new vote class that was the same as highlight’s but also with bold. I tried a lot of silly thing without tokens and without defini…
