In this tutorial, we will show you how you can add a Sticky Table Of Contents in the Sidebar.
Step 1: Go to Appearance > Widget > here you will find the Sidebar section of your theme.

Step 2: Click on the “+” icon to add the Sticky Sidebar Table Of Contents block.

Step 3: After adding the block, you can see an option called Advance Settings, by enabling this option you can customize the Scroll Fixed Position, Fixed Top Position, Scroll Max Height, and Sidebar Width according to your need.

Step 4: Now click on the update and that’s it, the Sticky Table of Contents will start to appear on your post/pages

Output:
Note: Highlighting of the headings will depend on the Theme which you are using on your end.
That’s it for this tutorial!
We hope we’ve cleared your doubts in case you have any feedback or questions, then please share them in the comments section below.