# Generic \[wrap\]/Markdown-it Custom Token Types causing errors in RTE

**URL:** https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922
**Category:** Bug
**Tags:** composer
**Created:** [August 8, 2025, 7:01pm UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922 "2025-08-08T19:01:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Alteras](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alteras/32/179824_2.png) [@Alteras](https://meta.discourse.org/u/Alteras)
#### Post date: [August 8, 2025, 7:01pm UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/1 "2025-08-08T19:01:38Z")

</div>

**Priority/Severity** : Low?

**Platform** : Devices using new RTE.

**Description** : Creating custom token types, which previously worked fine with just the markdown-it engine, causes errors with ProseMirror. As without a ProseMirror schema to handle the parsed to DOM, any custom token types create an error. Similarly there are behavior issues when toggling between RTE and Markdown with BBCode.

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/a/8/1a8decac95d8839fd3ce983e6270a1244ca5badd.png)

**Reproducible steps** :

RTE First:

1. Open Editor
2. Set mode to RTE
3. Insert custom BBCode.  
a. For example with Discourse Meta: `[wrap=test2 user-id=1]Content[/wrap]`
4. Dismiss error and toggle between RTE and md mode.  
a. BBCode is escaped  
 ![image](https://global.discourse-cdn.com/meta/original/4X/2/9/e/29e8f4e7bfdc1dda9f7df6ae8f2e4f4093233ffb.png)

Markdown First:

1. Open Editor
2. Set mode to Markdown
3. Insert custom BBCode.
4. Toggle between md mode and RTE.  
a. BBCode is not visible  
 ![image](https://global.discourse-cdn.com/meta/original/4X/6/b/f/6bfd4d33ad68208070e3501b1f451f5cbb88cc0b.png)
5. Toggle back to see raw.

**Current workaround** :  
Use Markdown mode only instead.

* * *

Getting the error itself isn’t that big of a deal, the bigger issue is with the weird behavior when toggling or when inserting the code.

The ideal solution would be for every markdown plugin to create a proper wizard/ProseMirror schema to handle it.

With regards to the generic `[wrap]` bbcode, perhaps just letting it stay in plain text is best, since multiple components could be using the generic bbcode in the same Discourse instance. The ideal solution is probably to let devs create a custom wizard and match the output to their own implementations, and let it fallback to plain text if no matches are found.

More generally, with any existing plugins that haven’t been updated to use ProseMirror, letting it default to plain text (that isn’t escaped/hidden) would be a nice interim fallback.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 11, 2025, 2:41am UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/2 "2025-08-11T02:41:14Z")

</div>

Thanks for reporting, @renato is keeping an eye out for edge cases like this, wrap has been our go-to for certain theme components, we will get it working.

---

<div class="post-metadata">

### Author: ![pierrox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pierrox/32/251996_2.png) [@pierrox](https://meta.discourse.org/u/pierrox)
#### Post date: [August 19, 2025, 8:07am UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/4 "2025-08-19T08:07:03Z")

</div>

I get a similar error message if I add the Gallery tag `[grid]`in Markdown and then re-edit my post in WYSIWYG mode.

---

<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: [August 25, 2025, 4:16pm UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/5 "2025-08-25T16:16:44Z")

</div>

I understand the issue is known and worked on, I just add the actual error message:

`No parser processed bbcode_open token for tag: div, attrs: [["class","d-image-grid"]]`

For folks who will search this string on meta after experiencing this issue (like I just did). 🙂

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 26, 2025, 4:13am UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/6 "2025-08-26T04:13:46Z")

</div>

We are aware, issue indeed is being worked on, should have it resolved in a few weeks.

---

<div class="post-metadata">

### Author: ![SubStrider](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/substrider/32/512604_2.png) [@SubStrider](https://meta.discourse.org/u/SubStrider)
#### Post date: [October 4, 2025, 7:35am UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/8 "2025-10-04T07:35:40Z")

</div>

Ran into this myself. Glad that its being worked on.

Grid makes the posts look beautiful instead of a horrible mess when users upload multiple images in the post.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [January 16, 2026, 6:22pm UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/11 "2026-01-16T18:22:15Z")

</div>

`[wrap]` is now supported on the rich editor, I’m closing this but please feel free to open a new topic if you find any issues.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [January 16, 2026, 6:22pm UTC](https://meta.discourse.org/t/generic-wrap-markdown-it-custom-token-types-causing-errors-in-rte/377922/12 "2026-01-16T18:22:20Z")

</div>


