A Parsedown Extra package for Laravel 5
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src Delete the unneeded `@deprecated` PHPDoc tag Jan 8, 2017
.gitattributes Small changes Aug 26, 2016
.travis.yml Update Travis CI tests Jan 14, 2017
README.md Minor changes in README.md Dec 26, 2016


Parsedown Extra for Laravel

A Parsedown Extra package for Laravel 5.3.x

Build Status Latest Stable Version Latest Unstable Version License

Compatibility table

Laravel parsedown-extra-laravel
5.1.x 0.3.x
5.2.x 0.4.x
5.3.x 0.5.x

Installation via Composer

  • Open your composer.json file and add the following line in the require object:

Stable version

"alfredo-ramos/parsedown-extra-laravel": "~0.5"

Development version

"alfredo-ramos/parsedown-extra-laravel": "~0.6@dev"
  • Run composer install or composer update on your terminal.

  • Open your config/app.php file and add the following in the providers array:

  • Register the facade in the aliases array (config/app.php file):
'Markdown'  => AlfredoRamos\ParsedownExtra\Facades\ParsedownExtra::class
  • And finally deploy all the files needed on your terminal:
php artisan vendor:publish \
    --provider='AlfredoRamos\ParsedownExtra\ParsedownExtraServiceProvider' \
    --tag=config --force



{!! Markdown::parse("Hello world") !!}
{!! Markdown::parse("[XSS link](javascript:alert('xss'))") !!}

The code above will print:

<p>Hello world</p>

<!-- HTML Purifier enabled -->
<p><a>XSS link</a></p>

<!-- HTML Purifier disabled -->
<p><a href="javascript:alert('xss')">XSS link</a></p>

For a live demo, go to Parsedown Extra Demo.

HTML Purifier

The package mews/purifier is used to filter the HTML output. By default a <KEY> string will be searched in the config/parsedownextra.php file to override HTML Purifier default settings, you can also pass an array.

Using a string

Markdown::parse('Hello world!', ['config' => 'comments'])

Where comments is the key of the array settings in config/parsedownextra.php.

Using an array

Markdown::parse('[DuckDuckGo](https://duckduckgo.com/)', ['config' => [
    'URI.Host' => 'localhost',
    'URI.DisableExternal' => true

For all configuration options see the official HTML Purifier config docs.

Using the default settings

Markdown::parse('Hello world!')
// Is the same as
Markdown::parse('Hello world!', ['config' => 'parsedown'])

You can temporarily disable it by setting the option purifier to false:

Markdown::parse('Text', ['purifier' => false])

HTML Purifier can be disabled permanently in the config/parsedownextra.php file.