Skip to content

jenstornell/php-table-of-contents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Table of Contents

Version 1.2 - Changelog

In short

  • Convert html to a clickable table of contents
  • Convert headings to support ID links
  • Really small file
  • Super simple usage

Usage

$toc = new PHPTableOfContents($html);

// Output the table of contents
echo $toc->list();

// Output the content
echo $toc->html();

Result

Below is how a styled table of contents list may look like.

Screenshot

Known limitations

  • 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

Donate to DevoneraAB if you want.

License

MIT

Releases

No releases published

Packages

No packages published