Useful extensions for customizing the league/commonmark parser
league/commonmark-extras is a collection of useful extensions and utilities for the league/commonmark project.
$ composer require league/commonmark-extras
Extensions can be added to any new
use League\CommonMark\CommonMarkConverter; use League\CommonMark\Environment; use League\CommonMark\Extras\SmartPunct\SmartPunctExtension; // Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go $environment = Environment::createCommonMarkEnvironment(); // ADD YOUR OWN EXTENSIONS HERE. For example: $environment->addExtension(new SmartPunctExtension()); // 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 email@example.com instead of using the issue tracker.
This library is licensed under the BSD-3 license. See the License File for more information.