Note: Some plugins are not yet compatible with PHP 8 or WP 5.7 and are therefore deactivated

LuckyWP Table of Contents
For longer posts, an automated table of contents can be useful for linking to paragraphs of interest. LuckyWP Table of Contents allows you to insert a TOC automatically or manually via a Gutenberg block, and the TOC will be generated automatically from the headings. Oh – and one cool trick. The automatically generated html anchors makes sense, so its #Some-header-text and not #9d8bcd3eab.

Demo tekst with Table of Contents block
Quisque nec purus augue. Curabitur in tellus eget ante consequat blandit. Proin nec gravida odio. Nam eleifend, magna id dignissim sagittis, ante est lacinia orci, eu malesuada sapien mauris ut nisi.
Nulla id turpis suscipit, accumsan risus ut, ullamcorper quam.
Quisque vel orci a dolor pellentesque imperdiet.
Vivamus auctor orci ex, a convallis turpis tempor quis. Aenean aliquet sit amet dui in eleifend. Nullam suscipit arcu a consequat pellentesque. In hac habitasse platea dictumst. Morbi ultricies lacus sit amet volutpat efficitur
Pellentesque eu dapibus nibh
Duis eleifend ante eget rhoncus ultrices. Proin maximus non erat vitae iaculis. Suspendisse pulvinar, neque vitae tempus convallis, metus metus faucibus nulla, at iaculis tortor est at est.
Quisque tempor justo tellus, non interdum ex lobortis non.
Sed viverra elit in ante finibus, sed tempor erat congue.
In lacinia gravida lorem, ut egestas eros lacinia ac. Nulla sit amet varius erat. Proin consequat massa sit amet neque eleifend tempor a nec leo. Nam nec dapibus lectus, sed tristique urna. Praesent imperdiet congue metus sed convallis. Ut facilisis ex massa, sit amet laoreet sapien posuere non.
Nullam porttitor consectetur aliquet.
Vivamus tincidunt ligula ultrices nisi scelerisque consequat. Vivamus malesuada felis quis tincidunt sollicitudin.
Extract from WordPress.org
Creates SEO-friendly table of contents for your posts, pages or custom post types. Great customizable appearance. Features automatical insertion a table of contents (configure post types and position).
https://wordpress.org/plugins/luckywp-table-of-contents/