lepture/mistune

Support a minimum level requirement in the TOC directive

spenserblack opened this issue · 2 comments

Thanks for this awesome library! ❤️

Motivation

I'm using mistune to parse documents that always have one level 1 heading. For example, the document might look like this:

# mistune

A fast yet powerful Python Markdown parser with renderers and plugins.

## Sponsors

...

## Install

...

The generated table of contents always includes the level 1 heading, which is redundant since it is used as a page title, and is the only level 1 heading.

Suggestion

I think a new keyword argument on the directive's class and/or an option on the directive could be helpful. If, for example, the minimum is 2, then only ## to ###### headings would be included in the table of contents.

Good catch. I'll add it into version 3.

Added it in 3.0.0rc2