league / commonmark-extras
Useful extensions for customizing the league/commonmark Markdown parser
Fund package maintenance!
colinodell
Patreon
Installs: 79 884
Dependents: 7
Suggesters: 0
Security: 0
Stars: 30
Watchers: 4
Forks: 5
Open Issues: 0
Type:commonmark-extension
Requires
- php: ^7.1
- league/commonmark: ^1.3
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2020-04-04 16:05:42 UTC
README
DEPRECATED
This extension has been deprecated. All of its functionality now exists in league/commonmark
1.3+. You can either register the various extensions individually or use the GithubFlavoredMarkdownExtension
to get full GFM functionality, so you should upgrade to that version of league/commonmark
and use that instead of this one.
Overview
league/commonmark-extras is a collection of useful GFM extensions and utilities for the league/commonmark project.
Adding this extension to your project will automatically register these sub-extensions:
Extension | Purpose |
---|---|
league/commonmark-ext-autolink | Automatically creating links to URLs and email address (without needing the <...> syntax) |
league/commonmark-ext-smartpunct | Intelligently converts ASCII quotes, dashes, and ellipses to their Unicode equivalents |
league/commonmark-ext-strikethrough | Adds support for ~~strikethrough~~ syntax |
league/commonmark-ext-table | GFM-style tables |
league/commonmark-ext-task-list | GFM-style task lists - [x] Like this |
Install
Via Composer
$ composer require league/commonmark-extras
Usage
This can be added to any new Environment
:
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!');
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email colinodell@gmail.com instead of using the issue tracker.
Credits
License
This library is licensed under the BSD-3 license. See the LICENSE file for more information.