lalejand
(Loïc Alejandro)
6 Febbraio 2026, 2:15pm
1
Nel mio post, per motivi estetici, uso alcuni blocchi “wrap”. Il plugin TOC non visualizza i titoli che si trovano nei blocchi “wrap”. Vorrei che lo facesse.
“Pas de mini-webinaire” non viene visualizzato nel TOC
Canapin
(Coin-coin le Canapin)
6 Febbraio 2026, 2:48pm
2
Funziona per me
<div data-theme-toc="true"> </div>
Ciao,
## Test 1
[wrap=miniWebinaire]
## **Nessun mini-webinar**
Ci vediamo a marzo per un mini-webinar con :mechanical_arm:
[/wrap]
## Test2
1 Mi Piace
Moin
6 Febbraio 2026, 4:42pm
3
Il supporto per le intestazioni all’interno di [wrap] è stato aggiunto in
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