# ToC not working when headers are inside a div?

**URL:** https://meta.discourse.org/t/toc-not-working-when-headers-are-inside-a-div/276615
**Category:** Support
**Tags:** disco-toc
**Created:** [September 6, 2022, 8:35pm UTC](https://meta.discourse.org/t/toc-not-working-when-headers-are-inside-a-div/276615 "2022-09-06T20:35:51Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [September 6, 2022, 9:40pm UTC](https://meta.discourse.org/t/toc-not-working-when-headers-are-inside-a-div/276615/2 "2022-09-06T21:40:30Z")

</div>

I think this was mentioned previously, if I understand it right:

> [@DiscoTOC - automatic table of contents](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/330):
>
> I have posts that have extra DIVs in their bodies. For example, [On Storytelling - Public - Podcaster Community](https://forum.podcaster.community/t/on-storytelling/268) The DIV which triggers the TOC generation is inside a DIV… and TOC notices that. But other headings, inside DIVs, don’t seem to get noticed by TOC. …not the best screenshot. That’s an H2 in an arbitrary/just-for-styling DIV which does not appear in the TOC. …not shown is the \<div that triggers the TOC, which is inside the DIV with the crazy att…

> [@DiscoTOC - automatic table of contents](https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143/331):
>
> We target the immediate child headings to exclude headings in quotes or oneboxes and other elements in the Table of Contents. Otherwise, we’d have to exclude them individually, which can be tedious.

---

_[View the full topic](https://meta.discourse.org/t/toc-not-working-when-headers-are-inside-a-div/276615)._
