Craft does not provide the function of table of contents, so I made an extension for the side bar. This extension can instantly generate a 4-level directory according to the document structure, and click the directory item to scroll to the corresponding position of this page. Beside, when you select a block in the page, the corresponding directory item will be highlighted.
Many thanks for sharing this eXtension, @Kermit! It’s VERY helpful to have a table of contents in Craft, especially for the longer documents.