Skip to content
Marcos Caceres edited this page Mar 27, 2026 · 3 revisions

data-max-toc

Applies to: <section>

Limits the ToC depth for this section subtree, without setting a global limit via maxTocLevel. Useful when some sections need deep nesting but their subsections shouldn't clutter the ToC.

Usage

<section data-max-toc="2">
  <h2>Infrastructure</h2>
  <section>
    <h2>Concepts</h2>          <!-- included in ToC -->
    <section>
      <h2>Details</h2>         <!-- NOT in ToC (depth 3 > max 2) -->
    </section>
  </section>
</section>
<section data-max-toc="0">
  <h2>Internal Notes</h2>      <!-- NOT in ToC -->
</section>

Notes

  • data-max-toc="0" is equivalent to class="notoc" — the section and all its children are excluded from ToC
  • Depth is counted from the section itself (not the document root)
  • See maxTocLevel for a document-wide depth limit

Guides

Configuration options

W3C Configuration options

Linting rules

Internal properties

Handled by ReSpec for you.

Special <section> IDs

HTML elements

Custom Elements

HTML attributes

CSS Classes

Special properties

Clone this wiki locally