<?php

use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use League\CommonMark\Extras\CommonMarkExtrasExtension;
//use Webuni\CommonMark\TableExtension\TableExtension;
use Evirma\CommonMark\Extension\AttributesExtension;

$mdenvironment = Environment::createCommonMarkEnvironment();

$mdenvironment->addExtension(new CommonMarkExtrasExtension());
//$mdenvironment->addExtension(new TableExtension());
$mdenvironment->addExtension(new AttributesExtension());

$mdconverter = new CommonMarkConverter([], $mdenvironment);

function md2html($markdown) {
    global $mdconverter;

    return $mdconverter->convertToHtml($markdown);
}
