PHP code example of jonnybarnes / commonmark-linkify

1. Go to this page and download the library: Download jonnybarnes/commonmark-linkify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jonnybarnes / commonmark-linkify example snippets


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>