Skip to content

Instantly share code, notes, and snippets.

@dkesberg
Created November 21, 2013 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkesberg/7581812 to your computer and use it in GitHub Desktop.
Save dkesberg/7581812 to your computer and use it in GitHub Desktop.
Ciconia Markdown Parser ServiceProvider & Facade for Laravel 4 Ciconia offers Github Flavored Markdown as extension and i really like to have "proper" linebreaks ;) Ciconia: https://github.com/kzykhys/Ciconia Laravel: https://github.com/laravel/laravel Github Flavored Markdown: https://help.github.com/articles/github-flavored-markdown
<?php
namespace dkesberg\Facades;
use Illuminate\Support\Facades\Facade;
class CiconiaFacade extends Facade {
protected static function getFacadeAccessor()
{
return 'markdown';
}
}
<?php
/**
* only uses the gfm whitespace extension for linebreaks, check out the ciconia repository for more options
*/
namespace dkesberg\ServiceProvider;
use Ciconia\Ciconia;
use Ciconia\Extension\Gfm;
use Illuminate\Support\ServiceProvider;
class MarkdownServiceProvider extends ServiceProvider {
public function register()
{
$this->app->bind('markdown', function()
{
$ciconia = new Ciconia();
$ciconia->addExtension(new Gfm\WhiteSpaceExtension());
return $ciconia;
});
}
}
@extends('layouts.master')
@section('content')
<div>
{{ Markdown::render($content) }}
</div>
@stop
@metude
Copy link

metude commented Jan 6, 2014

Could you give me a bit information how to install?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment