Useful extensions for customizing the league/commonmark Markdown parser
league/commonmark-extras is a collection of useful extensions and utilities for the league/commonmark project.
Adding this extension to your project will automatically register these sub-extensions:
|league/commonmark-ext-autolink||Automatically creating links to URLs and email address (without needing the
|league/commonmark-ext-smartpunct||Intelligently converts ASCII quotes, dashes, and ellipses to their Unicode equivalents|
$ composer require league/commonmark-extras
This can be added to any new
use League\CommonMark\CommonMarkConverter; use League\CommonMark\Environment; use League\CommonMark\Extras\CommonMarkExtrasExtension; // Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go $environment = Environment::createCommonMarkEnvironment(); // REGISTER THIS EXTENSION HERE $environment->addExtension(new CommonMarkExtrasExtension()); // Define your configuration: $config = ; // Now that the `Environment` is configured we can create the converter engine: $converter = new CommonMarkConverter($config, $environment); // Go forth and convert you some Markdown! echo $converter->convertToHtml('# Hello World!');
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email firstname.lastname@example.org instead of using the issue tracker.
This library is licensed under the BSD-3 license. See the LICENSE file for more information.