willvincent / laravel-markdown by willvincent

Markdown including typographic prettification based on 'SmartyPants'
1
1
1
Package Data
Maintainer Username: willvincent
Maintainer Contact: will@willvincent.com (Will Vincent)
Package Create Date: 2016-06-24
Package Last Update: 2016-06-24
Language: PHP
License: MIT
Last Refreshed: 2024-12-22 15:03:18
Package Statistics
Total Downloads: 1
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Laravel Markdown

Provides a markdown parser facade, with optional typographical prettification using SmartyPants to Laravel 5.x.

Installation

Download the package with composer:

composer require willvincent/laravel-markdown

NOTE: You may need to add the following to your composer.json to allow dev packages to be installed:

"minimum-stability": "dev",
"prefer-stable": true

Update your config/app.php file to reference the provider and facade:

'providers' => [
    // ...
    willvincent\LaravelMarkdown\LaravelMarkdownServiceProvider::class,
],
'aliases' => [
    // ...

    'Markdown' => willvincent\LaravelMarkdown\Facades\LaravelMarkdownFacade::class,
],

Run php artisan vendor:publish to copy the default config file into your app's config directory; config/markdown.php

Usage

Usage is simple, pass markdown you want to parse (and optionally prettify based on your config settings) to the parse() method of the Markdown facade.

// Assuming $text is a variable populated with markdown...
Markdown::parse($text)

Presumably most people will use this to display data loaded from their database within a blade template;

  <div class="parsed-markdown-text">{!! Markdown::parse($text) !!}</div>