TOC plugin change? Support TOC levels

Hi,

in short:

  • I want levels, e.g. [toc 3]
  • Current plugin does not support it, looks abandoned
  • What can be done about this?

Longer version:

Currently it's possible to put [toc]in note to generate Table Of Content. But it lists all headings. I'd like to be able to optionally specify the max level to generate, for example [toc max-level=3] (or [toc 3] or whatever syntax is chosen) to generate TOC only for headings of level 1, 2, 3.

As I understand, Joplin uses markdown-it-toc-done-right to handle the [toc]. This plugin does not support the level feature. The last commit to the repo was 6 years ago.

So I'd like to discuss if anything can be done in this case?

  • does anyone knows if the plugin is actually abandoned - would it be possible to add such feature to it?
  • lack of updates for 6 years makes me worried about security (dependencies... but maybe this is handled when it's integrated with Joplin?)
  • if not, could we fork it and add such feature?
  • otherwise, maybe choosing a different plugin would be possible?

This is assuming such feature (level configuration) is something that is useful for others, not only me.

Maybe there's already a Joplin plugin that allows this feature. I have not found it. Plus there's the issue of trust/security of external plugins...

It has already been done! :slight_smile:

If you want just levels 1 & 2 use

$<toc{"level":[1,2]}>

just 2,3 & 4 use

$<toc{"level":[2,3,4]}>

etc.

instead of [TOC]

See this merged PR from 2019 for further details.