lalejand
(Loïc Alejandro)
6 Febrero, 2026 14:15
1
En mi publicación, por razones estéticas, utilizo algunos bloques “wrap”. El complemento TOC no muestra los títulos que están en bloques “wrap”. Me gustaría que lo hiciera.
“Pas de mini-webinaire” no se muestra en el TOC
Canapin
(Coin-coin le Canapin)
6 Febrero, 2026 14:48
2
Me funciona
<div data-theme-toc="true"> </div>
Hola,
## Prueba 1
[wrap=miniWebinaire]
## **Sin mini-webinario**
Nos vemos en marzo para un mini-webinario con :mechanical_arm:
[/wrap]
## Prueba2
1 me gusta
Moin
6 Febrero, 2026 16:42
3
Se añadió soporte para encabezados dentro de [wrap] en
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