silverbullet icon indicating copy to clipboard operation
silverbullet copied to clipboard

[TOC] Configuration options

Open zefhemel opened this issue 1 year ago • 10 comments

Enable TOC configuration in SETTINGS:

  • In which panel to appear (default: preface, but also support lhs and rhs)
  • At what # of headers the TOC should be enabled

zefhemel avatar Nov 25 '23 17:11 zefhemel

Note: the configuration of where the panel should appear should be client specific. For one, I’d like it to be different on my phone (top), iPad and desktop (maybe right or left), so rather than putting it in SETTINGS this needs to be stored using clientStore and be configured with a command.

Second: the logic about whether the TOC should appear at all likely also has to be different. When the TOC renders on the left or right, and you switch between pages, there will be a significant content jump between page switches if it’s not persistently there.

zefhemel avatar Nov 25 '23 18:11 zefhemel

It would also be nice to be able to disable the TOC on some pages, either with a frontmatter flag or some inline directive. (Mediawiki provides a __NOTOC__.)

jimt avatar Nov 26 '23 08:11 jimt

It would also be nice to be able to disable the TOC on some pages, either with a frontmatter flag or some inline directive. (Mediawiki provides a __NOTOC__.)

I also think it would be a good idea to be able to disable plugins (TOC, Linked Mentions...) for specific pages.

damufo avatar Feb 09 '24 09:02 damufo

I'm using this to disable toc on some pages

---
description: Adds a Table of Contents to pages
tags: template
hooks.top:
  where: toc != false

And then I just add toc=false to the front mater of pages where I want it diabled

davidbeijinho avatar Feb 10 '24 08:02 davidbeijinho

Sorry, I'm a newbie. Where do you put this:

description: Adds a Table of Contents to pages
tags: template
hooks.top:
   where: touch != false

In SETTINGS?

Very thanks!

damufo avatar Feb 11 '24 16:02 damufo

in your silverbullet instance you should open the Library/Core/Widget/Table of Contents using the template picker

and replace this line where: 'true' with where: toc != false

and now in any page that you do not want the table of contents widget you just need to add to frontmatter a prop like

---
toc: false
---

davidbeijinho avatar Feb 12 '24 14:02 davidbeijinho

I'm using a docker compose, which after making the change I restarted it. I think I'm doing something wrong because it doesn't work for me. Thank you for your time.

image image

damufo avatar Feb 14 '24 17:02 damufo

At some point somebody mistyped "toc" as "touch". Just use "toc" everywhere so toc != false

zefhemel avatar Feb 14 '24 20:02 zefhemel

Unrelated: are you using an outdated Firefox by any chance? Looking at your screenshot it looks like FF earlier than 121. I'd upgrade if you can to not have the weird button placement.

zefhemel avatar Feb 14 '24 20:02 zefhemel

This work fine!! 🙂

At some point somebody mistyped "toc" as "touch". Just use "toc" everywhere so toc != false But, how hide frontmatter section?

Very thanks!

image

damufo avatar Feb 14 '24 20:02 damufo