jonnybarnes/commonmark-linkify

This package is abandoned and no longer maintained. No replacement package was suggested.

Turn plaintext URLs into click-able links

v0.5.1 2019-02-17 10:48 UTC

This package is not auto-updated.

Last update: 2020-01-16 23:33:11 UTC


README

This extention to CommonMark turns plain text URLs into clickable links.

Usage

use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Jonnybarnes\CommonmarkLinkify\LinkifyExtension;

$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new LinkifyExtension());

$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));

echo $converter->convertToHtml('Some text-only link https://example.org');
// Some text link <a href="https://example.org">example.org</a>