Version 1.2 - Changelog
- Convert html to a clickable table of contents
- Convert headings to support ID links
- Really small file
- Super simple usage
$toc = new PHPTableOfContents($html);
// Output the table of contents
echo $toc->list();
// Output the content
echo $toc->html();
Below is how a styled table of contents list may look like.
- You can't provide an h1 in the
$html
. It will not know what to do with the h1. - Don't add an ID tag to your headers because the will collide with IDs from Table of Contents IDs.
- Supports characters like åäöûè for ID generation but not chinese etc.
Donate to DevoneraAB if you want.
MIT