league/commonmark-extras

Useful extensions for customizing the league/commonmark parser

0.1.2 2016-09-19 22:04 UTC

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

league/commonmark-extras is a collection of useful extensions and utilities for the league/commonmark project.

Install

Via Composer

$ composer require league/commonmark-extras

Usage

Extensions can be added to any new Environment:

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!');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

New features and extensions are welcome! Please see CONTRIBUTING and CONDUCT for details.

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.