diff options
Diffstat (limited to 'lib/markup.php')
-rw-r--r-- | lib/markup.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/markup.php b/lib/markup.php index 2f25c6c..f6ddd0f 100644 --- a/lib/markup.php +++ b/lib/markup.php @@ -7,6 +7,19 @@ class markup { return $pd->text($md); } + public static function toc(string $md): string { + $pd = new MyParsedown([ + 'toc' => [ + 'lowercase' => true, + 'transliterate' => true, + 'urlencode' => false, + 'headings' => ['h1', 'h2', 'h3'] + ] + ]); + $pd->text($md); + return $pd->contentsList(); + } + public static function htmlToText(string $html): string { $text = html_entity_decode(strip_tags($html)); $lines = explode("\n", $text); |