by Marc Tönsing on WordPress.org
SEO-friendly Table of Contents Gutenberg block. No JavaScript and no CSS means faster loading.

SimpleTOC block in Gutenberg editor.
Add a Table of Contents block to your posts and pages. The TOC is a nested list of links to all heading found in the post or page. To use it, simply add a block and search for “SimpleTOC” or just “TOC”.
The maximum depth of the toc can be configured in in the blocks’ sidebar among many other options. There can hide the headline “Table of Contents” and add your own by using a normal heading block.
Spin up a new WordPress instance with the SimpleTOC plugin already installed.
“It is lightweight, stable, and fully compatible with WordPress Full Site Editing. A reliable solution that integrates seamlessly and performs exactly as expected.”
— @js100 on wordpress.org“Does the job perfectly, and adds no bloat.”
— @clicknathan on wordpress.org“Simple yet powerful. Great plugin that does exactly what you need.”
— @mixey on wordpress.org
This plugin is designed & developed for WCAG 2.2 level AA conformance. The plugin is tested with assistive technology and intended to be accessible, however some third party plugins or themes may affect the individual accessibility on a given website. If you find an accessibility issue, please let us know and we’ll try to address it promptly.
SimpleTOC is open-source and developed on GitHub Pages. If you find a bug or have an idea for a feature please feel free to contribute and create a pull request.
This plugin is forked from pdewouters and uses code from Easy-Table-of-Contents
Many thanks to Tom J Nowell and and Sally CJ who both helped me a lot with my questions over at wordpress.stackexchange.com
And many more thanks to all the developers on GitHub who helped me making SimpleTOC what it is today!
Thanks to Quintus Valerius Soranus for inventing the Table of Contents around 100 BC.