jonnybarnes / commonmark-linkify
Turn plaintext URLs into click-able links
Installs: 7 741
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^7.1
- league/commonmark: ^0.18.0
Requires (Dev)
- phpunit/phpunit: ~7.0
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>