# Rich text editor converts bbcode into display math

**URL:** https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463
**Category:** Bug
**Tags:** composer, markdown, math
**Created:** [February 19, 2026, 2:49am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463 "2026-02-19T02:49:27Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![panic](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@panic](https://meta.discourse.org/u/panic)
#### Post date: [February 19, 2026, 2:49am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/1 "2026-02-19T02:49:27Z")

</div>

## Description

When pasting bbcode into rich text editor, brackets are escaped as \[and \]. However, this makes it a valid display math block, so it is erroneously rendered as math.

### Reproduction

1. Copy the following text

2. Paste into something like notepad.exe

3. Copy from notepad.exe to remove formatting information

4. Paste into rich text editor

5. The text should display as code; uncheck the “code” toggle button to make it plain text

Alternatively, you can type the bbcode shown above manually into the rich text editor.

### Expected behaviour

Either

> > **summary**
> >
> > some text

which is fine, since that is the original meaning of the bbcode, or

> [details=“summary”]  
> some text  
> [/details]

which is also fine, since that is what you see in the wysiwyg editor.

### Actual behaviour

> details="summary"
> 
> some text
> 
> /details

which is not fine.

---

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [February 19, 2026, 6:12pm UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/2 "2026-02-19T18:12:11Z")

</div>

I have not been able to reproduce this problem. I’ve tried on both my Macbook Pro and on a Windows desktop, where I was able to follow your Reproduction instructions verbatim.

In both cases, I accessed the site using the Firefox web browser.

---

<div class="post-metadata">

### Author: ![panic](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@panic](https://meta.discourse.org/u/panic)
#### Post date: [February 20, 2026, 12:08am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/3 "2026-02-20T00:08:29Z")

</div>

Hi Mark,

Can you reproduce by manually typing some bbcode into the rich text editor (i.e. not pasting into it)? Clipboard formatting is indeed a complicated manner…

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [February 20, 2026, 12:20am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/4 "2026-02-20T00:20:20Z")

</div>

If you have people pasting bbcode, you can try disabling `discourse_math_enable_latex_delimiters`.

But I also can’t reproduce the problem. In my case what was available on the clipboard was:

```plaintext
Formats: TIMESTAMP,TARGETS,SAVE_TARGETS,MULTIPLE,STRING,UTF8_STRING,TEXT,text/plain,text/plain;charset=utf-8,chromium/x-internal-source-rfh-token,chromium/x-source-url
'[details="summary"]\nsome text\n[/details]'

```

or the plain version:

```plaintext
Formats: TARGETS,UTF8_STRING
'[details="summary"]\nsome plain text\n[/details]\n'

```

Using browser copy/paste (instead of the copy button) I had on my clipboard:

```plaintext
Formats: TIMESTAMP,TARGETS,SAVE_TARGETS,MULTIPLE,STRING,UTF8_STRING,TEXT,text/html,text/plain,text/plain;charset=utf-8,chromium/x-internal-source-rfh-token,chromium/x-source-url
UTF8_STRING:
b'[details="summary"]\nsome text\n[/details]'
text/html:
b'<span style="color: rgb(199, 199, 199); font-family: &quot;JetBrains Mono&quot;, Consolas, Monaco, monospace; font-size: 15.75px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre; background-color: rgba(0, 0, 0, 0.25); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">[details="summary"]\nsome text\n[/details]</span>'
text/plain:
b'[details="summary"]\nsome text\n[/details]'
text/plain;charset=utf-8:
b'[details="summary"]\nsome text\n[/details]'

```

but even that pasted fine.

---

<div class="post-metadata">

### Author: ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)
#### Post date: [February 20, 2026, 2:02am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/5 "2026-02-20T02:02:20Z")

</div>

Yes, I can now verify this behavior by simply typing into the Rich Text editor:

details=”summary”

Here are the not-so hidden details.

/details

Having said that, the rich editor provides tools to enter these type of things via a point and click interface. If you want to enter hidden details, then I guess you should use that interface.

 ![Screenshot 2026-02-19 at 8.58.45 PM](https://global.discourse-cdn.com/meta/original/4X/5/a/4/5a4e7d9e6d3ddc0527dc89e673b9b289c98b2982.png)

Let’s see if it works:

> **Summary**
>
> This text really is hidden!!

---

<div class="post-metadata">

### Author: ![panic](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@panic](https://meta.discourse.org/u/panic)
#### Post date: [February 20, 2026, 3:40am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/6 "2026-02-20T03:40:14Z")

</div>

It seems that my system injects a \<pre\>\<code\> for the clipboard…

```plaintext
> arguments[0].clipboardData.getData('text/html')
'<pre><code class="lang-plaintext hljs language-plaintext" data-highlighted="yes">[details="summary"]
some text
[/details]
</code></pre>' 

```

Anyway, the main point is that what you see in the wysiwyg editor is not what you get.

---

<div class="post-metadata">

### Author: ![panic](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@panic](https://meta.discourse.org/u/panic)
#### Post date: [February 20, 2026, 3:44am UTC](https://meta.discourse.org/t/rich-text-editor-converts-bbcode-into-display-math/396463/7 "2026-02-20T03:44:48Z")

</div>

> [@mcmcclur](#):
>
> the rich editor provides tools to enter these type of things via a point and click interface.

Yes!

What happened on our instance was that someone provided a template for others to fill in; something like …

```plaintext
[details="Part 1"]
- [] check
- [] check
- [] check
[/details]
[details="Part 2"]
- [] check
- [] check
- [] check
[/details]
...

```

… and then many people came back (unexpectedly) with display maths like …

details="Part 1"

- [] check
- [x] check
- [] check

/details

details="Part 2"

- [x] check
- [] check
- [x] check

/details

Thanks again for your attention!
