markdown-toc icon indicating copy to clipboard operation
markdown-toc copied to clipboard

Suggestion: a way to ignore certain headings

Open daughtkom opened this issue 7 years ago • 4 comments

It would be nice to have some sort of way to ignore certain headers and omit them from the TOC. In my example below, the TOC is in the Contents section, so it doesn't really need to be included.

image

One idea might be to optionally ignore sections containing the TOC itself. Another might be some syntax similar to:

## Contents  <!-- TOC omit:true -->

It's not really a big deal, but would be nice.

daughtkom avatar Jun 29 '17 00:06 daughtkom

Thank your for your advice, it's a good idea, i will add it when version 1.6.0~

alanwalk avatar Jul 25 '17 07:07 alanwalk

Would be great to have 1.6.0 released in the store! Thanks for implementing it!

berezovskyi avatar Dec 04 '17 23:12 berezovskyi

So 1.6.0 is not released yet?

bflatmajor avatar Sep 30 '18 15:09 bflatmajor

This feature seems to appear in the source code:

https://github.com/AlanWalk/markdown-toc/blob/c9cddf99543ca1eb40e17b46d5bd69bb330d8d07/src/extension.ts#L27

However, writing something like this does not work

## Table of Contents <!-- TOC ignore:true -->

<!-- TOC depthFrom:2 -->
...
<!-- /TOC -->

Seems like the because of #50, <!-- TOC ignore:true --> is interpreted as just <!-- TOC --> with some wrong parameters and the result becomes:

<!-- TOC -->
...
<!-- /TOC -->

(the header as well as anything between it and /TOC gets erased)

@AlanWalk would you be happy to accept a PR and release a new version?

kachkaev avatar Feb 24 '19 15:02 kachkaev