Repository navigation
Optional table of contents - #199
Closed
choucavalier wants to merge 1 commit into
Closed
choucavalier wants to merge 1 commit into
choucavalier wants to merge 1 commit into
Conversation
choucavalier
marked this pull request as draft
October 13, 2026 11:22
Author
|
@Fil wdyt? |
Contributor
|
Hello Valentin, I don't think that's something we'd want to support as a code feature of notebook-kit; it would be nice to share as an add-on to a template, though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of all, super excited by the new notebook implem', that i've been using extensively over the past two weeks. It's great!
I've been mostly working on pretty long notebooks, with multiple sections and figures, and I found that they would really benefit from a table of contents:
##and###headings already get anchors, but there's no way to see where you are or to jump to another sectionThe tricky part is wide content: text is 640px but plots, tables and code take the full 960px, so a sidebar either squeezes them or ends up on top of them
I've been working on an opt-in version that I think deals with this nicely:
The list floats at the edge of the window and highlights the current section. Nothing moves, figures keep their full width. When a chart, image, table, code block or aside passes under it, it collapses to small marks, and you can hover or tap them to open the list again. It's hidden on phones, so the mobile rendering doesn't change
You can also write
toc="left"for the other side,toc="column"to make room for it instead of floating (kind-of like in Framework), ortoc="marks"to always keep it collapsedWithout the attribute, notebooks render exactly as before
The branch is here: https://github.com/choucavalier/notebook-kit/tree/toc
Two questions:
<notebook>ok? it's the natural place next tothemeandreadonly, but Desktop and the cloud editor share the same format and would probably drop it on savetoc? the extra options are about 50 lines and easy to removeWDYT?