PHP code example of benjaminhoegh / parsedown-extended

1. Go to this page and download the library: Download benjaminhoegh/parsedown-extended 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/ */

    

benjaminhoegh / parsedown-extended example snippets




use BenjaminHoegh\ParsedownExtended\ParsedownExtended;

$parsedown = new ParsedownExtended();

echo $parsedown->text('Hello _Parsedown_!');

echo $parsedown->line('Hello _Parsedown_!');

$parsedown = new ParsedownExtended();

$parsedown->config()->set('toc', true);
$parsedown->config()->set('toc.levels', ['h1', 'h2', 'h3']);
$parsedown->config()->set('math.enabled', true);
$parsedown->config()->set('allow_raw_html', false);

$parsedown->config()->set('toc', [
    'levels' => ['h1', 'h2', 'h3'],
    'tag' => '[TOC]',
    'id' => 'table-of-contents',
]);

echo $parsedown->text($markdown);

$body = $parsedown->body($markdown);
$toc = $parsedown->contentsList();

echo $toc;
echo $body;