marksman icon indicating copy to clipboard operation
marksman copied to clipboard

Add table of contents configuration

Open airtonix opened this issue 2 years ago • 5 comments

i want it to ignore the h1 , or

i want it to ignore headings that are specially tagged/annotated with some non renderable syntax.

airtonix avatar Sep 23 '22 11:09 airtonix

Hi @airtonix !

i want it to ignore the h1

This should be pretty straightforward.

specially tagged/annotated with some non renderable syntax

Could you give an example?

artempyanykh avatar Sep 23 '22 16:09 artempyanykh

Some ideas:

Control exactly where to start from

# Title

<!-- toc:start from(#something) -->
- [Something](#something-1)
- [Something](#something-2)
- [Something](#something-3)
  - [Darkside](#darkside)
<!-- toc:end -->

## Something 

words words words

## Something 

words words words

## Something 

words words words

### Darkside

words words words

if we could support for custom heading ids:

# Title

<!-- toc:start from(#something-last) -->
- [Something](#something-last)
  - [Darkside](#darkside)
<!-- toc:end -->

## Something 

words words words

## Something 

words words words

## Something {#something-last}

words words words

### Darkside

words words words

Vaguely specify tags to exclude

# Title

<!-- toc:start from(.h2) -->
- [Something](#something-1)
- [Something](#something-2)
- [Something](#something-last)
  - [Darkside](#darkside)
<!-- toc:end -->

## Something 

words words words

## Something 

words words words

## Something {#something-last}

words words words

### Darkside

words words words

ability to ignore certain headind instances

# Title

<!-- toc:start from(.h2) ignore(#something-1) -->
- [Something](#something-2)
- [Something](#something-last)
  - [Darkside](#darkside)
<!-- toc:end -->

## Something 

words words words

## Something 

words words words

## Something {#something-last}

words words words

### Darkside

words words words

or

# Title

## Intro

<!-- toc:start from(.h2) ignore(#something-unimportant, #intro) -->
- [Something](#something-1)
- [Something](#something-last)
  - [Darkside](#darkside)
<!-- toc:end -->

## Something 

words words words

## Something {#something-unimportant}

words words words

## Something {#something-last}

words words words

### Darkside

words words words

airtonix avatar Sep 28 '22 06:09 airtonix

@airtonix I like that, thanks for writing it down!

artempyanykh avatar Oct 02 '22 18:10 artempyanykh

I also support this. No need to reinvent a new syntax though, there are some editor plugins that do something very similar, one could maybe just copy their syntax?

the MarkdownTOC plugin for Sublime, for example, has syntax for various things suggested in this issue

chrisgrieser avatar Jun 29 '23 09:06 chrisgrieser

I guess everyone has their own way.

https://github.com/yzhang-gh/vscode-markdown/blob/0b75960d5d27f9e7d20960290e03e7127223de42/README.md?plain=1#L62

austinbutler avatar Jul 18 '24 23:07 austinbutler