Giter Site home page Giter Site logo

php-table-of-contents's Introduction

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

php-table-of-contents's People

Contributors

jenstornell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.