PHP code example of weph / commonmark-section-extension

1. Go to this page and download the library: Download weph/commonmark-section-extension 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/ */

    

weph / commonmark-section-extension example snippets


use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Weph\CommonMark\SectionExtension;

$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new SectionExtension());

$converter = new MarkdownConverter($environment);

echo $converter->convert(<<<EOMD
# Title

## Section 1

Section 1 content

### Section 1.1

Section 1.1 content

## Section 2

Section 2 content
EOMD
);