Download the PHP package clippings/parsedown-provider without Composer
On this page you can find all versions of the php package clippings/parsedown-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clippings/parsedown-provider
More information about clippings/parsedown-provider
Files in clippings/parsedown-provider
Package parsedown-provider
Short Description Pimple service provider for Parsedown.
License MIT
Informations about the package parsedown-provider
Parsedown Service Provider
This is a service provider for the Markdown parser Parsedown. It could be used to easily use and configure Parsedown with Pimple or Silex.
Installation
Install the latest version with Composer:
Usage
Register the service provider in the Pimple container and enjoy!
It registers one service - parsedown
which returns the same instance of Parsedown
.
Configuration
You can configure it like that:
It accepts the following configuration parameters:
-
parsedown.class
- The class to use to instantiate Parsedown. Default:Parsedown
. You can use that to load an an extension of Parsedown likeParsedownExtra
.Don't forget to
composer require erusev/parsedown-extra
and then you can do: -
parsedown.breaks_enabled
- Whether to treat line breaks as new lines or not. Default:true
. This is not the default for Markdown and Parsedown, but it is very common configuration - e.g. GitHub treats line breaks like that. -
parsedown.markup_escaped
- Whether to escape HTML. Default:false
. parsedown.urls_linked
- Whether URLs are linked by default. Default:true
. This is the Parsedown default. URLs would be auto-linked. It is similar to GFM.
Twig
If you have already registered Twig, probably with the TwigServiceProvider
, the Parsedown service provider would also register a parsedown
Twig filter for you to use in your templates.
You can use it like that:
This will convert the Markdown you have directly in your template and output HTML using the same Parsedown instance you have configured.
Silex Application Trait
If you use it with Silex you can add the ParsedownTrait
in your application:
Then you could use it like that:
Authors and License
The Parsedown provider was developed by the Clippings.com team and is distributed under the MIT license.
Read more about our projects at the Clippings Geeks blog.