PHP code example of league / commonmark-ext-autolink
1. Go to this page and download the library: Download league/commonmark-ext-autolink 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/ */
league / commonmark-ext-autolink example snippets
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\AutolinkExtension;
// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go
$environment = Environment::createCommonMarkEnvironment();
// Add this extension
$environment->addExtension(new AutolinkExtension());
// Instantiate the converter engine and start converting some Markdown!
$converter = new CommonMarkConverter([], $environment);
echo $converter->convertToHtml('I successfully installed the https://github.com/thephpleague/commonmark-ext-autolink extension!');
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;
$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(InlineMentionParser::createTwitterHandleParser());
// TODO: Instantiate your converter and convert some Markdown
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;
$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(InlineMentionParser::createGithubHandleParser());
// TODO: Instantiate your converter and convert some Markdown
use League\CommonMark\Environment;
use League\CommonMark\Ext\Autolink\InlineMentionParser;
$environment = Environment::createCommonMarkEnvironment();
$environment->addInlineParser(new InlineMentionParser('https://www.example.com/users/%s/profile'));
// TODO: Instantiate your converter and convert some Markdown
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.