We need your support to maintain this package. 💖 https://github.com/sponsors/ueberdosis
A hint extension for league/commonmark that renders the following Markdown as HTML.
:::important Warning!
This is how the **Markdown** looks.
:::
<div class="hint important">
<h2 class="hint-title">
Warning!
</h2>
<p class="hint-content">
This is how the <strong>Markdown</strong> looks.
</p>
</div>
You can install the package via composer:
composer require ueberdosis/commonmark-hint-extension
<?php
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Ueberdosis\CommonMark\HintExtension;
// Configure the Environment with all the CommonMark parsers/renderers
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
// Add this extension
$environment->addExtension(new HintExtension());
// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
$markdown = <<<MARKDOWN
:::important Warning!
This is how the **Markdown** looks.
:::
MARKDOWN;
echo $converter->convertToHtml($markdown);
composer test
The MIT License (MIT). Please see License File for more information.