lalejand
(Loïc Alejandro)
6. Februar 2026 um 14:15
1
In meinem Beitrag verwende ich aus ästhetischen Gründen einige „Wrap“-Blöcke. Das TOC-Plugin zeigt Titel, die sich in „Wrap“-Blöcken befinden, nicht an. Ich möchte aber, dass es das tut.
„Pas de mini-webinaire“ wird im TOC nicht angezeigt
Canapin
(Coin-coin le Canapin)
6. Februar 2026 um 14:48
2
Bei mir funktioniert es
<div data-theme-toc="true"> </div>
Hallo,
## Test 1
[wrap=miniWebinaire]
## **Kein Mini-Webinar**
Wir sehen uns im März zu einem Mini-Webinar mit :mechanical_arm: wieder.
[/wrap]
## Test2
1 „Gefällt mir“
Moin
6. Februar 2026 um 16:42
3
Unterstützung für Überschriften innerhalb von [wrap] wurde hinzugefügt 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