2017 © Pedro Peláez
 

library laravel-markdown

Simple Blade directive for markdown parsing.

image

andreasindal/laravel-markdown

Simple Blade directive for markdown parsing.

  • Monday, May 7, 2018
  • by andreasindal
  • Repository
  • 4 Watchers
  • 120 Stars
  • 41,922 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 12 Forks
  • 1 Open issues
  • 15 Versions
  • 16 % Grown

The README.md

⚠️ Important

This project is no longer maintained, will not received any updates and will not support future versions of Laravel., (*1)


Laravel-Markdown

Build Status, (*2)

A small, lightweight and easy-to-use Laravel package for handling markdown. It comes with a facade, a helper function and a Blade directive to make life easier for you., (*3)

Laravel version Laravel-Markdown version
5.8, 6.* 3.1.1
5.7 3.0.1
5.6 3.0
5.5 2.0
5.3, 5.4 1.1
5.2 1.0

Installation

To install it, simply pull it down with Composer. Run the php artisan vendor:publish command to publish the configuration file., (*4)

composer require andreasindal/laravel-markdown:"3.0.1"

Laravel 5.5 and above use Package Auto-Discovery, so you do not have to manually add the MarkdownServiceProvider., (*5)

Usage

Blade-directive

The markdown parser may be used in your Blade templates by using the @markdown directive., (*6)

<article>
    <h1>{{ $post->title }}</h1>

    <section class="content">
        @markdown($post->body)
    </section>
</article>

You can also use a block-style syntax:, (*7)

@markdown
# Hello world

This *text* will be **parsed** to [HTML](http://laravel.com).
@endmarkdown

Facade

If you registered the Markdown facade as shown above, you can easily parse markdown using it., (*8)

$markdown = "# Hello";

$html = Markdown::parse($markdown) // 

Hello

Helper-functions

$html = markdown('# Hello'); // <h1>Hello</h1>
$html = markdown_capture(function () {
    echo "# Hello";
    echo "\n\n";
    echo "So **cool**!"
});

// 

Hello

//

So cool!, (*9)


Of course, you could also resolve the parser from the service container and use it yourself., (*10)

$parser = app('Indal\Markdown\Parser');
$html = $parser->parse('# Hello'); // 

Hello

Drivers (NEW!)

Laravel-Markdown allows you to add custom markdown drivers. In order to use a custom markdown driver, you need to create a class that implements the Indal\Markdown\Drivers\MarkdownDriver interface. The interface contains two methods: text and line. text is used to convert a block of markdown to HTML, while line is used to convert a single line., (*11)

Laravel-Markdown ships with a ParsedownDriver using the Parsedown-package by @erusev., (*12)

Credits

License

Licensed under MIT. For more information, see the LICENSE-file., (*13)

The Versions

07/05 2018

2.0.x-dev

2.0.9999999.9999999-dev

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

07/05 2018

1.1.x-dev

1.1.9999999.9999999-dev

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

07/05 2018

dev-master

9999999-dev

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

03/03 2018

1.0.x-dev

1.0.9999999.9999999-dev

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

03/03 2018

3.0.0

3.0.0.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

30/08 2017

2.0.0

2.0.0.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

30/08 2017

2.0-rc-2

2.0.0.0-RC2

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/01 2017

1.1.6

1.1.6.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

08/11 2016

1.1.5

1.1.5.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/09 2016

1.1.3

1.1.3.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/08 2016

1.1.2

1.1.2.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/08 2016

1.1.1

1.1.1.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/08 2016

1.1.4

1.1.4.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

18/08 2016

1.1

1.1.0.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal

20/03 2016

1.0

1.0.0.0

Simple Blade directive for markdown parsing.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andreas Indal