2017 © Pedro Peláez
 

library laravel-commonmark

Compile laravel blade templates and strings into markdown

image

harrk/laravel-commonmark

Compile laravel blade templates and strings into markdown

  • Thursday, February 15, 2018
  • by Harrk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Laravel Commonmark

Build Status, (*1)

Laravel Commonmark is a wrapper for league/commonmark which allows for the parsing of regular Markdown as well as CommonMark. The CommonMark spec can be found at http://commonmark.org., (*2)

This package can parse Markdown inline or within blade templates using the .md.blade.php file extension., (*3)

Why?

I was looking for a Markdown compiler for Laravel and with being unable to find a package compatible with Laravel 5.6 (at the time). I figured I could take a crack at it. This also seemed like a good opportunity to gain some experience with open-source projects., (*4)

Installation

This package has been updated to work with Laravel 6.0, just install via composer:, (*5)

$ composer require "harrk/laravel-commonmark=~v2.0"

Usage

Blade

Simply name a blade view with the .md.blade.php extension and it'll automatically parse Markdown within the view into HTML when rendered., (*6)

Any .md.blade.php files can be included into other blade files using @import as you would a regular view., (*7)

Dependency Injection

use \League\CommonMark\CommonMarkConverter;

class MyClass {

    public function myFunction(CommonMarkConverter $converter) {
        return $converter->convertToHtml('# H1 Header');
    }

}

Or if you prefer using helper functions instead:, (*8)

class MyClass {

    public function myFunction() {
        return markdown_to_html('# H1 Header');
    }

}

Unit Testing

To run unit tests:, (*9)

$ vendor/bin/phpunit

Alternatives

Check out graham-campbell/markdown for a package that offers far greater customisation through the use of CommonMark extensions., (*10)

The Versions

15/02 2018

dev-master

9999999-dev

Compile laravel blade templates and strings into markdown

  Sources   Download

MIT

The Requires

 

The Development Requires

15/02 2018

v1.0.3

1.0.3.0

Compile laravel blade templates and strings into markdown

  Sources   Download

MIT

The Requires

 

The Development Requires

15/02 2018

v1.0.2

1.0.2.0

Compile laravel blade templates and strings into markdown

  Sources   Download

MIT

The Requires

 

The Development Requires

13/02 2018

1.0.0

1.0.0.0

Compile laravel blade templates and strings into markdown

  Sources   Download

MIT

The Requires

 

The Development Requires