2017 © Pedro Peláez
 

library laravel

Official Laravel Wrapper of Parsedown.

image

parsedown/laravel

Official Laravel Wrapper of Parsedown.

  • Tuesday, January 9, 2018
  • by eagostini
  • Repository
  • 2 Watchers
  • 19 Stars
  • 9,652 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 8 Versions
  • 39 % Grown

The README.md

You might also like Caret - our Markdown editor for Mac / Windows / Linux., (*1)

Parsedown for Laravel

Build Status, (*2)

This package is a Laravel wrapper around Parsedown. If you want to know more about Parsedown alone check out our base repository., (*3)

Features

  • Blade Directive
  • Configuration File
  • Helper Function

Installation

Parsedown for Laravel is available as a Composer package. You can install it using the command below:, (*4)

``` bash composer require parsedown/laravel, (*5)


### Configuration If you're using **Laravel** +5.5 you don't need to follow the steps below. The [package auto-discovery](https://laravel-news.com/package-auto-discovery) feature has been implemented and will take care of loading the service provider for you. But if that's not your case you will need to add the service provider to your `config/app.php` file: ``` php return [ // Other configurations above...    'providers' => [ // Other providers above... Parsedown\Providers\ParsedownServiceProvider::class, // Other providers below... ], // Other configurations below... ];

This package uses the Parsedown\Providers\ParsedownServiceProvider service provider to create a singleton of Parsedown. That's stored it in a container called parsedown. It uses the following options to set the default behavior for that instance:, (*6)

Name Description Default
breaks_enabled Converts line breaks such as \n into <br /> tags. false
inline Enables inline parsing for the parsedown() helper and the @parsedown directive by default. false
markup_escaped Escapes HTML in trusted input. Redundant if safe_mode is enabled. false
safe_mode Doesn't process untrusted user-input. true
urls_linked Automatically converts URLs into anchor tags. true

You can overwrite these values by publishing the config/parsedown.php file with the following command:, (*7)

``` sh php artisan vendor:publish --provider="Parsedown\Providers\ParsedownServiceProvider", (*8)


### Usage The snippets below show how you can easily use **Parsedown** in your `*.blade.php` files: ``` blade @parsedown('Hello _Parsedown_!')

...or (using the helper approach), (*9)

``` blade {{ parsedown('Hello Parsedown!') }}, (*10)


Any of the code above will generate: ``` html <p>Hello <em>Parsedown</em>!</p>

If you want to parse a value using the inline style you just need to set the second argument as true:, (*11)

``` blade @parsedown('Hello Parsedown!', true), (*12)


...or (using the helper approach) ``` blade {{ parsedown('Hello _Parsedown_!', true) }}

Any of the code above will generate:, (*13)

``` html Hello Parsedown!, (*14)


The helper is globally available and can also be used with **PHP** code throughout your project. ## Lumen Support **Laravel** and **Lumen** pretty much share the same core code. The instructions below should be enough to set this package for your **Lumen** project. ### Enable Facades in Your Project Ensure you have the following in your `bootstrap/app.php` file: ```php $app->withFacades();

Service Provider Registering

As Lumen does not support package auto-discovery you got to do it manually adding the code below in your bootstrap/app.php file:, (*15)

$app->register(Parsedown\Providers\ParsedownServiceProvider::class);

The Versions

09/01 2018

dev-master

9999999-dev http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Agostini

laravel parsedown

09/01 2018

dev-develop

dev-develop http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Agostini

laravel parsedown

09/01 2018

1.1.0

1.1.0.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Agostini

laravel parsedown

09/01 2018

1.0.1

1.0.1.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Agostini

laravel parsedown

23/08 2017

1.0.0

1.0.0.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Eduardo Agostini

laravel parsedown

19/07 2017

0.0.3

0.0.3.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

by Eduardo Agostini

laravel parsedown

08/05 2017

0.0.2

0.0.2.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

by Eduardo Agostini

laravel parsedown

08/05 2017

0.0.1

0.0.1.0 http://parsedown.org

Official Laravel Wrapper of Parsedown.

  Sources   Download

MIT

The Requires

 

by Eduardo Agostini

laravel parsedown