2017 © Pedro Peláez
 

library laravel-markdown-plus

A simple Laravel Markdown Parser with an optional meta section in the .md file

image

maxxscho/laravel-markdown-plus

A simple Laravel Markdown Parser with an optional meta section in the .md file

  • Saturday, August 2, 2014
  • by maxxscho
  • Repository
  • 2 Watchers
  • 42 Stars
  • 157 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

NOT MAINTAINED ANYMORE!!, (*1)

Laravel Markdown-Plus

Build Status, (*2)

A simple Laravel 4 parser for markdown files with an optional meta-data section., (*3)

Installation

Laravel Markdown-Plus can be installed via composer by requiring the maxxscho/laravel-markdown-plus package in your project's composer.json., (*4)

{
    "require": {
        "maxxscho/laravel-markdown-plus": "~0"
    }
}

Next add the service provider and the alias to app/config/app., (*5)

'providers' => [
    // ...
    'Maxxscho\LaravelMarkdownPlus\LaravelMarkdownPlusServiceProvider',
],

'aliases' => [
    // ..
    'MarkdownPlus' => 'Maxxscho\LaravelMarkdownPlus\Facade\LaravelMarkdownPlusFacade',
],

Usage

Markdown file example

The meta section should be in YAML style, seperated by a custom splitter, which can be set in the config as a regular expression, default 3 or more dashes in an own line. Example:, (*6)

title: This is the title
subtitle: This is the subtitle
date: 5. September 2013
tags: [code, laravel]
---
# Content goes here

Lorem Ipsum ...

Usage in Laravel

$file = File::get('test.md');

$document = MarkdownPlus::make($file);
$content = $document->getContent();
$title = $document->title(); // magic method

return View::make('your-view', compact('title', 'content'));

The meta data will be parsed with Symfony's Yaml Parser. After parsing the meta is an multidimensional array.
! Dates in the format YYYY-MM-DD will be parsed into a timestamp., (*7)

Available methods

$document->getContent() - returns the parsed Markdown (HTML-Content), (*8)

$document->getRawContent() - returns the raw content (pure Markdown), (*9)

$document->getMeta() - returns the whole meta data as an multidimensional array, (*10)

$document->title() - this is a magic method. The name of the method returns its equivalent meta. For example $document->cool-meta() return the value of cool-meta: Cool Value, (*11)

Configuration

Laravel-Markdown-Plus comes with some basic configuration.
Publish the configuration to customize the options:, (*12)

php artisan config:publish maxxscho/laravel-markdown-plus 

You'll find the config file in app/config/packages/maxxscho/laravel-markdown-plus, (*13)

Available Config-Options

'use_meta' => true, - whether you wanna use meta data or not, (*14)

'section_splitter' => '/\s+-{3,}\s+/', - the seciton splitter, (*15)

'use_extra' => true, - do you wanna parse markdown with additional features, (*16)

'markdown_parser_options' - options for the markdown parser itself. More infos, (*17)

Licencse

This is free software distributed under the terms of the MIT license., (*18)

Additional information

Inspired by an based on Dayle Rees Kurenai., (*19)

This package uses:, (*20)

The Versions

02/08 2014

dev-master

9999999-dev

A simple Laravel Markdown Parser with an optional meta section in the .md file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Markus Schober

laravel markdown

22/07 2014

1.0

1.0.0.0

A simple Laravel Markdown Parser with an optional meta section in the .md file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Markus Schober

laravel markdown

21/07 2014

0.2

0.2.0.0

A simple Laravel Markdown Parser with an optional meta section in the .md file

  Sources   Download

MIT

The Requires

 

The Development Requires

by Markus Schober

laravel markdown

16/07 2014

0.1

0.1.0.0

A simple Laravel Markdown Parser with an optional meta section in the .md file

  Sources   Download

MIT

The Requires

 

by Markus Schober

laravel markdown