Customize which headings are shown in the TOC
Currently it’s hardcoded as
h1:not(:first-of-type)[id],
h2:first-child[id],
:not(h1) + h2[id]
Should we allow this to be customizable?
One issue here is that with multiple levels in the TOC (say, h2, h3), users will want the hierarchy be reflected visually. We could at a minimum provide some classes that reflect the hierarchical level?
users will want the hierarchy be reflected visually
I could understand how the current limitation makes the visual noise on the report more manageable.
Though, from another side, I think there're use cases where the user intends to present a structure in the report/dashboard and expects that the structure is also visually represented.
I am not not expert on the front-end tech stack here, but maybe this could controlled by an ObservableHQ configuration at first which could have a default, then it becomes the decision of the user; observablehq.config.js:
export default {
toc: true,
maxHeadingLevel: 2
}