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

Feature request: better Table of Contents (collapsible, auto-scroll, only some headings etc.)

Open ManasMadrecha opened this issue 2 years ago • 3 comments

Hi, first of all, thanks for this amazing extension 💛

It would be great to have some more features in the Table of Contents:

Auto scroll

  • As one scrolls the page, the TOC should also scroll to that respective heading's position.
  • This is enabled on several websites (e.g., Vue), and even in VS Code
  • Maybe it can be achieved using Intersection Observer

Collapsible Headings

  • For a document with several headings, the TOC can become very long.
  • So, it would be great to collapse the TOC to show only upto a certain heading, i.e. H2 or H3
  • It can be achieved by simply using details tag in the TOC's headings texts.

TOC Headings option

  • If the collapsible option is present, then that's great
  • If not, then the extension should an option to choosing the order up to which headings should be generated.
  • E.g., one may not need H5 or H6 headings to clutter the TOC.

Thanks once again.

ManasMadrecha avatar Nov 26 '21 11:11 ManasMadrecha

These are all really great suggestions, thank you!

simov avatar Nov 27 '21 07:11 simov

#190 I implemented the collapsible toc, I'm using it for a while now and it's really useful when the toc is big.

giuseppe-dandrea avatar Nov 27 '22 08:11 giuseppe-dandrea

The Auto Scroll item was fixed in v5.1

simov avatar Mar 18 '23 09:03 simov