#6456 (How to make a local TOC in a page)
by Luc Saffre · in Developers · assigned to Luc Saffre
Summary
Goal: We want to have a way, in Lino, to have automatically generated TOC somewhere in a page, like in Sphinx with the contents directive, for example here a screenshot of the Welcome page of the Developer Guide:
![]()
Introduction:
Children
Comments
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I pushed my work on this. To be tested on real sites.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : Our sanitize function no longer removes every "id" attribute. Now I added 'id' to GENERALLY_ALLOWED_ATTRS.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I just use the existing Site.sidebar_width attribute. Recommended values are either 3 or 0. When it's 0, you get local tocs generated on the server, otherwise you get a sidebar with a toc generated on the client side.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I now have a local TOC and I like it... Todo: put it into a Card component, make a plugin setting for choosing which type of TOC to render.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I invested (wasted?) another session for implementing the TOC on the server side in Python.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : Is it allowed (is it possible, does it make sens) to use the MediaWiki CSS library with publisher? I mean as a new skin, besides bootstrap? I didn't yet find an answer. I gave up here: www.mediawiki.org/wiki/Developer_hub
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : Another issue with Aidan Feldmans bootstrap-toc is that (AFAICS) it vanishes completely on a small screen.
- 11 months, 3 weeks ago by Luc Saffre in reply to Luc Saffre about #6456 (How to make a local TOC in a page) : More precisely, I do like it and can imagine to use it for our documentation, but for laudate.ee it feels somehow wrong.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) (1 reply) : Result of my meditation: I don't like the TOC in the side bar!
In Wikipedia new style the TOC is hidden away in a button:
Or on SELFHTML you can still see the "old-styl" Wikimedia TOC:
⌧ - 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : Together with @8lurry i activated it locally. Looks nice. I'm still meditating on misc issues. For example when a page has no heading, the empty side bar looks silly...
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I tend to say that in the React front-end and in the quill editor we do not want any TOC. And bootstrap-toc seems to render outside of the page, so there isn't even a "toc marker" to be inserted anywhere because there is no choice.
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : For example this one for bootstrap: afeld.github.io/bootstrap-toc
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : My first visible results yesterday are maybe useless: there are JS scripts to do generate a TOC on the fly. But how to integrate them?
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : I had first visible results (but there is more to do): luc.lino-framework.org/blog/2025/1031.html
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : My first idea was a memo command, but the problem is that we must also insert anchors around each header. My next idea is something like the MORE_MARKER, and the work is done in lino.utils.soup
- 11 months, 3 weeks ago by Luc Saffre about #6456 (How to make a local TOC in a page) : Created new Ticket #6456 (How to make a local TOC in a page).