Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to exclude certain headings from TOC #68

Open
kilimnik opened this issue Nov 18, 2021 · 0 comments
Open

Ability to exclude certain headings from TOC #68

kilimnik opened this issue Nov 18, 2021 · 0 comments

Comments

@kilimnik
Copy link

I am looking for a way to exclude certain headings from the TOC.

For example I want a TOC for this md:

# Header 1

# Header 2 {no_toc}

# Header 3

I would like the resulting TOC to only include the first and third header.
I am unsure if an attribute is the best way to go, as I don't know if it is even possible for the plugin to remove it from the markdown. So it wouldn't get rendered.

Another idea would be to add a list or a callback as an option. The list would contain the headings to ignore. The callback would be called on each heading and the result would decide if this heading should be ignored.

I am also a little bit unsure about subheadings:

# Header 1

## Subheader 1.1

## Subheader 1.2

# Header 2 {no_toc}

## Subheader 2.1

## Subheader 2.2

# Header 3

I think if the second header should be excluded all it's subheadings should be excluded too.

I already saw, there was a similar Issue #15. But that got closed without a real resolution.

I am open to contributing and adding the feature myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant