Skip to content

A Quarto extension that provides fine-grained control over table of contents depth at the header level.

License

Notifications You must be signed in to change notification settings

mcanouil/quarto-toc-depth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOC Depth Extension For Quarto

A Quarto extension that provides fine-grained control over table of contents depth at the header level.

Installation

quarto add mcanouil/quarto-toc-depth

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Usage

Add the filter to your document's YAML header:

filters:
  - toc-depth

Then control TOC depth for specific sections using the toc-depth attribute on headers: {toc-depth=N}.

Note

The TOC depth is relative to the section where it is defined.

# Section A {toc-depth=0}

This section and its subsections will not appear in the TOC.

## Subsection A1

This will be hidden from TOC.

# Section B {toc-depth=1}

This section will appear in the TOC, but its direct children will be hidden.

## Subsection B1

This will NOT appear in TOC (depth = 2).

### Subsection B1.1

This will NOT appear in TOC (depth = 3).

# Section C {toc-depth=2}

This section will appear in the TOC, along with its direct children.

## Subsection C1

This will appear in TOC (depth = 2).

### Subsection C1.1

This will NOT appear in TOC (depth = 3).

# Section D

This section uses the default TOC behaviour.

Example

Here is the source code for a minimal example: example.qmd.

Outputs of example.qmd:

About

A Quarto extension that provides fine-grained control over table of contents depth at the header level.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 2

  •  
  •  

Languages