- The problem
The TOC is generated first and then sub headings are inserted.
If existing article already has headings then those will no appear inside the TOC.
- Simple solution
Parse the article and create a TOC on demand.
If existing article already has headings then those will no appear inside the TOC.
TOC generation is now dynamic and reads from the generated article.
It even generates a nested TOC
This means TOC works for AI articles, even without needing to insert headings.
Also removed some footprints. ie colors etc. Instead its class name is TOC, so you have to style it with your site theme.
The links to each heading is now using slug instead of toc#nnn.
Less footprints using this dynamic version.