Scrollspy
The sidebar's “on this page” links highlight as sections pass — an IntersectionObserver in preview.js, not a scroll handler. This page spies on itself.
How it works
Links matching .doc-side__nav a[href^="#"] map to their sections; the observer's rootMargin (-10% top, -70% bottom) makes the “current” band the upper third of the viewport.
new IntersectionObserver(mark, { rootMargin: '-10% 0px -70% 0px'}).observe(section)the whole engine — no scroll listener, no jank
Watch the sidebar
Scroll this page: “How it works”, this section and the next trade the highlight.
filler section A
Section B
filler section B