Skip to content

A roam/render component to display a table of contents that allows you to jump to a location.

Notifications You must be signed in to change notification settings

LuisThiamNye/roam-toc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

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

About

A roam/render component to display a table of contents that allows you to jump to a location.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published