benfiratkaya/commonmark-ext-underline

This extension adds support for underline syntax. It allows users to use !! in order to indicate text that should be rendered within <u> tags.

1.0.0 2022-02-21 13:23 UTC

This package is auto-updated.

Last update: 2024-04-21 18:31:44 UTC


README

Tests

This extension adds support for underline syntax. It allows users to use ^^ in order to indicate text that should be rendered within tags.

Install

composer require benfiratkaya/commonmark-ext-underline

Example

use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use BenFiratKaya\CommonMarkExtension\Underline;

$environment = new Environment([]);
$environment->addExtension(new CommonMarkCoreExtension())
            ->addExtension(new UnderlineExtension());

$converter = new MarkdownConverter($environment);
$html = $converter->convertToHtml('^^test^^');

This creates the following HTML

<u>test</u>