Highlight the heading that is visible while the page is scrolled, for a table of contents.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Lists the h2 headings of the page and marks the one being read.
const useScrollSpy = (options?: {
selector?: string
offset?: number
}) => {
active: number
data: {
id: string
label: string
depth: number
element: HTMLElement
}[]
reinitialize: () => void
}