1. Go to this page and download the library: Download jifish/parsedown-toc-ext library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jifish / parsedown-toc-ext example snippets
use jifish\ParsedownTocExt\ParsedownToc;
$parser = new ParsedownToc();
$html = $parser->text($markdown);
$toc = $parser->getToc();
$tocText = $parser->renderToc();
use jifish\ParsedownTocExt\ParsedownExtraToc;
$parser = new ParsedownExtraToc();
use jifish\ParsedownTocExt\ParsedownToc;
class ParsedownTocCustomId extends ParsedownToc
{
// Generate random ids
protected function slugify(string $text): string
{
return uniqid();
}
}
$parser = new ParsedownTocCustomId();