1. Go to this page and download the library: Download cable8mm/toc 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/ */
use Cable8mm\Toc\Converters\CleanJustTopHConverter;
$toc = new Toc($markdown);
$toc->addConverters([
new CleanJustTopHConverter, // Removes standalone top-level # headings
]);
// Now parse
$reflection = new ReflectionMethod(Toc::class, 'normalize');
$reflection->setAccessible(true);
$reflection->invoke($toc);
use Cable8mm\Toc\Contracts\ConverterInterface;
use Cable8mm\Toc\Types\MarkdownString;
class MyConverter implements ConverterInterface
{
public function do(MarkdownString $markdown): MarkdownString
{
// Transform $markdown, then return a new MarkdownString
$cleaned = some_transformation((string) $markdown);
return new MarkdownString($cleaned);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.