PHP code example of cradeq / commonmark-html-whitelist-extension

1. Go to this page and download the library: Download cradeq/commonmark-html-whitelist-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/ */

    

cradeq / commonmark-html-whitelist-extension example snippets


use Cradeq\CommonMark\HtmlWhitelistExtension;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;

$environment = new Environment([
    'html_input' => 'strip', // Both strip and escape are supported
    'html_whitelist' => [
        'tags' => ['br', 'sub'], // Any set of html tags
    ],
]);
$environment->addExtension(new CommonMarkCoreExtension);
$environment->addExtension(new HtmlWhitelistExtension);