yansongda/laravel-parsedown

Convert Markdown To Html With Laravel

v1.1.0 2018-03-28 08:32 UTC

README

Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads Latest Unstable Version License

This Package depends on erusev/parsedown

Requirement

  • composer
  • laravel | lumen >= 5.1

Installation

$ composer require yansongda/laravel-parsedown

Add service provider(if laravel<5.5 || lumen)

<?php

Yansongda\LaravelParsedown\ParsedownServiceProvider::class,

// lumen
// $app->register(Yansongda\LaravelParsedown\ParsedownServiceProvider::class);
// $app->withFacades();

Add alias(if laravel<5.5)

<?php

'LaravelParsedown' => Yansongda\LaravelParsedown\Facades\Parsedown::class,

Config(OPTION)

$ php artisan vendor:publish --provider="Yansongda\\LaravelParsedown\\ParsedownServiceProvider" --tag=laravel-parsedown-config

Lumen user please manually copy the configuration file

config desc default
breaksEnabled automatic line breaks true
markupEscaped escapes markup (HTML) true
urlsLinked automatic linking of URLs true
safeMode safeMode false

Reference: erusev/parsedown

Usage

Using blade

<?php

@parsedown('## h2');

Using Helper

<?php

{{ parsedown('## h2') }}

License

MIT