lalejand
(Loïc Alejandro)
Février 6, 2026, 2:15
1
Dans mon post, pour des raisons esthétiques, j’utilise des blocs « wrap ». Le plugin TOC n’affiche pas les titres qui se trouvent dans les blocs « wrap ». J’aimerais qu’il le fasse.
« Pas de mini-webinaire » n’est pas affiché dans la TOC
Canapin
(Coin-coin le Canapin)
Février 6, 2026, 2:48
2
Ça fonctionne pour moi
<div data-theme-toc="true"> </div>
Bonjour,
## Test 1
[wrap=miniWebinaire]
## **Pas de mini-webinaire**
On se retrouve en mars pour un mini-webinaire avec :mechanical_arm:
[/wrap]
## Test2
1 « J'aime »
Moin
Février 6, 2026, 4:42
3
La prise en charge des titres à l’intérieur de [wrap] a été ajoutée dans
main ← dereklputnam:main
merged 12:22AM - 13 Jan 26 UTC
# Summary
Adds support for finding headings inside wrap blocks (`.wrap` and `.d… -wrap` classes), which are commonly used for email filtering with the `[wrap=no-email]` BBCode tag.
# Problem
When users wrap content with [wrap=XYZ], headings inside those blocks were not included in the table of contents. The original selector only looked for direct descendants of body:
```javascript
"body > h1, body > h2, body > h3, body > h4, body > h5"
```
We specifically use [wrap=no-email] to block our content from pushing to the email notification, which essentially broke the TOC for us.
# Solution
Extended the heading selector to also find headings inside .wrap and .d-wrap blocks:
```
const selector = [
"body > h1", "body > h2", "body > h3", "body > h4", "body > h5",
"body > .wrap h1", "body > .wrap h2", "body > .wrap h3", "body > .wrap h4", "body > .wrap h5",
"body > .d-wrap h1", "body > .d-wrap h2", "body > .d-wrap h3", "body > .d-wrap h4", "body > .d-wrap h5"
].join(",");
```
Headings are combined and sorted by document order to maintain proper TOC structure.
# Files Changed
javascripts/discourse/services/toc-processor.js - Modified processPostContent() method