Exclude a single heading from TOC

David C. 's Avatar

David C.

23 Jul, 2016 04:57 AM

Is there a way to exclude a single heading from the TOC?

I'd like to leave a heading at H2, but not have it appear in the table of contents. I could style around it, but it would be nice if there was an easy way to do this in the markdown file.

## one
## two (exclude from toc)
## three
## four

  1. Support Staff 1 Posted by Brett on 25 Jul, 2016 02:09 PM

    Brett's Avatar

    This is too much of an edge case to be incorporated directly, but you
    have a couple of options. Depending on what other header levels you're
    using, you could simply style h3 or h4 to look like h2, then set the toc
    to a max of 2. It would appear the same, but be excluded. You could also
    create the whole TOC via custom script using something like Kramdown,
    which has built in TOC capabilities and the ability to exclude headers
    using {: x} directives.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac