endachao/laravel-5-markdown-editor

Markup code not being parsed

geosem42 opened this issue · 3 comments

Hello,
Thank you for this package, it looks really good but I can't get it to work.

On create article, the editor shows and it displays correctly. When I submit it, the text gets submitted into the database like this **this is a bold text** and also displays the same way on the view.

The index() method

public function index()
    {

        $articles = Article::latest('published_at')->published()->get();

        $art = Article::findOrFail(64);

        //dd($art->body);

        return view('blog/index', ['content' => EndaEditor::MarkDecode($art->body)])->with('articles', $articles);
    }

Here I am trying to test it on an article with ID 64 which I just submitted with markdown editor.

And this is the form

@include('editor::head')

        <div class="editor">
            <p>
                {!! Form::label('body', 'Body:') !!}
                {!! Form::textarea('body', null, ['class' => 'form-control', 'id' => 'myEditor']) !!}
            </p>
        </div>

This is the js in resources/views/vendor/editor/head.blade.php

$.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $(function() {
        url = "{{ url(config('editor.uploadUrl')) }}";
        var myEditor = new Editor(url);
        myEditor.render('#myEditor');
    });

What am I doing wrong here?

EDIT: dd(EndaEditor::MarkDecode($art->body)) gives the output of "<p><strong>this is a new test</strong></p>" so in theory it should be working.

Sorry,
Let me understand your question

**this is a bold text**

It can not be resolved to the correct HTML ?

It's my mistake. I had to use {!! !!} instead of {{ }} when displaying comments on the view.

@Halnex Yes, after laravel 5, we have to do so