maphew
maphew4mo ago

cell bookmarks

Does marimo have "jump to cell" bookmarks? (that can be used from markdown or mo.md(f'''Jump to {target}... ) Or a table of contents widget?
3 Replies
Myles Scolnick
Myles Scolnick4mo ago
we show the table of contents on the right-hand side of the notebook. you can create entries with markdown:
# header
## subheader
### third header
# header
## subheader
### third header
maphew
maphewOP4mo ago
oh, that's what those lines are for! that's subtle. I can see how it's often desirable, but is there way in app mode to default to open the ToC, and have a collapse control instead? An open Outline on left side would by default would work better for app mode (for our audience).
Myles Scolnick
Myles Scolnick4mo ago
you can't currently. you can have the open outline in edit mode, but not app mode. you could also try mo.sidebar
mo.sidebar(
[
mo.md("# logo"),
mo.nav_menu(
{
"#home": f"{mo.icon('lucide:home')} Home",
"#about": f"{mo.icon('lucide:user')} About",
"#contact": f"{mo.icon('lucide:phone')} Contact",
},
orientation="vertical",
),
]
)
mo.sidebar(
[
mo.md("# logo"),
mo.nav_menu(
{
"#home": f"{mo.icon('lucide:home')} Home",
"#about": f"{mo.icon('lucide:user')} About",
"#contact": f"{mo.icon('lucide:phone')} Contact",
},
orientation="vertical",
),
]
)
but those #anchors would need to match up with your document. it wouldnt be auto-generated we could add mo.toc() which would be the auto-generated. (if you are open to making the contribution, i think it would be a great addition)