Ivan Mijatović

Ivan Mijatović

  • Work
  • Blog
  • Contact
  • Hire Me
  • Contents
  • Install package
  • How to use it
  • View
  • Home
  • Blog
  • How to generate Tabel of Contents
Ivan Mijatovic
By Ivan Mijatović

How to generate Tabel of Contents

  • Contents
  • Executive summary
  • Try it out
  • Let us know what youthink

Add Table of Contents to your blog post.

Install package

https://github.com/caseyamcl/toc

composer require caseyamcl/toc

How to use it

$markupFixer  = new \TOC\MarkupFixer();
$tocGenerator = new \TOC\TocGenerator();

$body  = "<div class='content'>" . $markupFixer->fix($guidePost->body) . "</div>";
$toc   = "<div class='toc'>" . $tocGenerator->getHtmlMenu($body) . "</div>";

View

{!! $toc !!}
{!! $body !!}

Related Articles

  • Composer.lock diff by comparing composer.lock to the the git HEAD.

  • Percentage Tracking Line TradingView Chart

  • TinyPng Hack to Overpass 500 images per month

  • Build signed APK file with Android Studio

;
Follow me on:
  • More about me

    • Quotes that Inspire me
    • My Bookshelve
  • Tools

    • Percentage Calculator
    • Slugify
    • Hard Choices
    • Days until Calculator
    • Password Generator
    • Online Alarm Clock
    • Timestamp Countdown
  • Check me out

    • Blog
    • Work
    • Contact me
  • Latest from Blog

    • Composer.lock diff by comparing composer.lock to the the git HEAD.
    • Percentage Tracking Line TradingView Chart
    • TinyPng Hack to Overpass 500 images per month
    • Build signed APK file with Android Studio

Ivan Mijatović

  • Help