Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.48 KB

README.md

File metadata and controls

36 lines (22 loc) · 1.48 KB

roam-toc

A roam/render component that automatically generates a table of contents for the current page.

When clicking a heading, it scrolls to the location of the block instead of focusing on the block.

Detailed instructions at RoamStack: Add a table of contents to your pages with roam-toc

Screenshot 2021-03-09 at 21 00 47

Usage: {{[[roam/render]]: ((ref-to-clojure-codeblock))}}

The code is in toc.cljs

I would recommend saving this as a template with #roam/templates

Some current limitations:

  • After you have manually collapsed a parent block of a heading, jumping to that hidden heading will no longer work. You will have to navigate away from the page and back.
{{word-count}} showing as -1? Here's a workaround
  1. Create a dedicated block for the {{word-count}} nested under the heading

  2. Create a block ref in the heading, pointed to the word count block.

Tweet

Changelog:

  • 2021-06-14: Can now expand collapsed blocks and jump to hidden headings.

  • 2021-05-14: Supports rendering markdown: Screenshot 2021-05-14 at 17 11 40