There is no license information available for the latest version (v1.0.3) of this package.

Markdown Text Editor (WYSIWYG) with social network embeds support and a nifty json output.

v1.0.3 2015-03-19 19:26 UTC

This package is auto-updated.

Last update: 2024-06-27 22:27:39 UTC


Markdown Editor

A sophisticated markdown editor supporting different kinds of embeds (Facebook, Twitter, Youtube, Images, Links) and transforms content into a clean JSON to be delivered to mobile devices or custom front-end UI.


  • Add the package to your composer.json and run composer update.
    "require": {
        "vinelab/laravel-editor": "*"
  • Add the service provider to the providers array in app/config/app.php
  • Publish the assets by running php artisan asset:publish vinelab/laravel-editor at the root of your project.

  • Access the editor with the Editor facade


  • jQuery

    • <script type="text/javascript" src="//"></script>
  • Bootstrap

    • <script type="text/javascript" src="//"></script>
    • <link rel="stylesheet" href="//">
  • Mr.Uploader: To have the photo cropping and upload working you need to add

Social Media Embeds

To have all the embeds working in the preview you will need to add the social media scripts to your HTML.


    window.fbAsyncInit = function() {
          appId      : '[YOU APP ID HERE]',
          xfbml      : true,
          version    : 'v2.1'

    (function(d, s, id){
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement(s); = id;
        js.src = "//";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));


<script async src="//" charset="utf-8"></script>


<script async src="//"></script>


Displaying the Editor

To display the editor you simply need to call


You may also call it passing existing content


Example with a Form

{{ Form::open(['url' => 'handle', 'method' => 'POST']) }}
    {{ Editor::view() }}
    {{ Form::submit() }}
{{ Form::close() }}

Retrieving Content

To get the content from the input use Editor::input() to get the editor's input name and use it with Input as such

$input = Input::get(Editor::input());

Then pass it to Editor::content($input) for the raw content or Editor::json($input) for the JSON representation of the output.

Raw Content

$content = Editor::content($input);
// $content is an instance of Vinelab\Editor\Content

The text used in the editor for this example is the following:

[Oxford Town](
<div class="fb-post" data-href="" data-width="500"></div>

<div class='fb-post' data-href='' data-width='500'></div>

<blockquote class="twitter-tweet" lang="en"><p>Sunsets don&#39;t get much better than this one over <a href="">@GrandTetonNPS</a>. <a href="">#nature</a> <a href="">#sunset</a> <a href=""></a></p>&mdash; US Dept of Interior (@Interior) <a href="">May 5, 2014</a></blockquote>

<iframe width="560" height="315" src="//" frameborder="0" allowfullscreen></iframe>


Lines are all 0 indexed

$json = $content->toJson();
    "text": "The text in here",
    "html": "<p>The text in here</p>",
    "embeds": {
        "facebook": [
                "url": "",
                "html": "<div class=\"fb-post\" data-href=\"\" data-width=\"500\"></div>",
                "line": 1
                "url": "",
                "html": "<div class='fb-post' data-href='' data-width='500'></div>",
                "line": 3
        "twitter": [
                "tweet": "<p>Sunsets don't get much better than this one over <a href=\"\">@GrandTetonNPS</a>. <a href=\"\">#nature</a> <a href=\"\">#sunset</a> <a href=\"\"></a></p>— US Dept of Interior (@Interior) <a href=\"\">May 5, 2014</a>",
                "lang": "en",
                "html": "<blockquote class=\"twitter-tweet\" lang=\"en\"><p>Sunsets don&#39;t get much better than this one over <a href=\"\">@GrandTetonNPS</a>. <a href=\"\">#nature</a> <a href=\"\">#sunset</a> <a href=\"\"></a></p>&mdash; US Dept of Interior (@Interior) <a href=\"\">May 5, 2014</a></blockquote>",
                "line": 5
        "youtube": [
                "id": "sOOebk_dKFo",
                "url": "",
                "html": "<iframe width=\"560\" height=\"315\" src=\"//\" frameborder=\"0\" allowfullscreen></iframe>",
                "line": 7
        "links": [
                "url": "",
                "text": "Oxford Town",
                "html": "<a href=\"\">Oxford Town</a>",
                "indices": [0, 11]