-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
It's more challenging than initially thought. What would be necessary to implement this is to:
- Tell the MDX component to map all of h1, h2, h3, ... to a component that attaches the
textContentas anid. This is necessary to set up URI fragment (anchoring with #). - Position the table of contents with
position: stickyto have it stick around while scrolling down. - Highlight the current heading in the table of contents through a prop to , eg.
currentHeading = "...". Use react-intersection-observer. The current heading is the first element currently in view. When an element exits view, the next element becomes thecurrentHeading. I think every heading needs to use theuseInViewhook.