"Toggle" shortcut for table of contents?

Table of contents (TOC) can give an overview of a page and allow easy navigation.

It seems that the necessity of a TOC has been pointed out before, especially for a long page or a page with multiple headlines.

If building a sidebar view of TOC is not easy (although it got a lot of votes), what about a temporary TOC?

Currently, there are two solutions:

  1. We can use the toggle t o to collapse/expand all blocks.
    This gives an overview of a page, but does not allow easy navigation (unless we want to go into a headline block rather than jump to it).
    Another downside is that collapsing or expanding all blocks can be extremely slow!!! It can even cause a crash of logseq.

  2. There is an awesome TOC plugin.
    However, to generate a TOC with this plugin, we need several steps: 1. Put the cursor into any line, 2. type /toc, 3. then hit Return".

I am wondering if there are any other methods for generating a temporary TOC?
Would it possible to have a “toggle” shortcut for TOC?

Thank you - I really like the idea. Simply display a TOC via shortcut - jump to the desired position and you’re done :blush:

(Unfortunately I don’t have any votes left at the moment).


I think it would be very handy to add a table of contents for the current document to the right-sidebar, which would allow users to navigate quickly through long documents. This is also the approach in Obsidian as shown in the below figure:


I have the same requirement about TOC. There are two functions I hope to achieve:
1. Just like PengYM’s reply, a TOC lives on the right-sidebar.
2. A TOC can be set up anywhere in the main text, e.g., the top of a text
(Lecture 7 - CS50x 2021).

Hey! Have created a TOC plugin if you all still need to use one!

More info: GitHub - hkgnp/logseq-toc-plugin

1 Like

This is now available in the market place btw!

The plugin looks really nice. Thank you!