maxxscho/
laravel-markdown-plus
g4t.io

Laravel Markdown-Plus

21 views 42 stars by Eric L. Barnes

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

README from maxxscho/laravel-markdown-plus Open on GitHub →

NOT MAINTAINED ANYMORE!!

Laravel Markdown-Plus

Build Status

A simple Laravel 4 parser for markdown files with an optional meta-data section.

Installation

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

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

Next add the service provider and the alias to app/config/app.

'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:

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.

Available methods

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

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

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

$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

Configuration

Laravel-Markdown-Plus comes with some basic configuration.
Publish the configuration to customize the options:

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

You'll find the config file in app/config/packages/maxxscho/laravel-markdown-plus

Available Config-Options

'use_meta' => true, - whether you wanna use meta data or not

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

'use_extra' => true, - do you wanna parse markdown with additional features

'markdown_parser_options' - options for the markdown parser itself. More infos

Licencse

This is free software distributed under the terms of the MIT license.

Additional information

Inspired by an based on Dayle Rees Kurenai.

This package uses:

More from the ecosystem

durable-workflow/
workflow
g4t.io
9 1,292

Durable Workflow: Long-Running Workflows for Laravel

Embedded durable workflow runtime and orchestration engine for Laravel applications.

durable-workflow/workflow via Laravel News
packstub/
session-replay
g4t.io
14 52

Session Replay for Laravel: Self-Hosted Browser Recordings

Session replay for Laravel: record what a person did in the browser with rrweb, keep the recording on your own disk and database, and watch it behind a gate you define — masked inputs by default, errors, failed Livewire requests and web vitals marked on the timeline, a link to the replay in every log line. packstub/filament-session-replay adds the sessions to a Filament panel.

packstub/session-replay via Laravel News
cyberwizard-dev/
schedule-catchup
g4t.io
17

Replay Missed Laravel Scheduled Tasks With Schedule Catchup

Schedule Catchup replays missed Laravel scheduled tasks after downtime, with opt-in recovery, bounded retries, and access to the original scheduled date.

cyberwizard-dev/schedule-catchup via Laravel News