Dynamically generate the table of contents from $Content
Automatically generate the table of contents from the Content of a page or, more generally, from any HTML field.
If you use composer, you could just run the following command:
composer require entidi/silverstripe-autotoc
To manually install it you should unpack or copy
into your SilverStripe root directory, rename it to
autotoc and do a
This module can be used without the CMS.
Part of this project (the Tocifier class) is intentionally decoupled from SilverStripe so it can be tested without pulling in all the framework.
From the module root directory you can trigger the testing by calling
phpunit (that must be previously installed on your system):
phpunit --bootstrap tests/Bootstrap.php tests/