@mniblett Did you figure this out?
best way to render markdown in views
OK, so I am want to have a text field that the user can use markdown with their input, and then when I show that input I want it rendered into HTML. In other words, just like this forum. I'm wondering what the best/easiest way of doing this is? I've looked at three different packages:
Option 1;
GrahamCampbell/Laravel-Markdown: useage: Markdown::convertToHtml('foo')
Here it looks like I will need to write a function inside my class (or maybe a trait to use across different classes, which I've never done but it would be a good exorcise for me to learn how to do that) to parse the output so I can write my blade files something like:
<p><strong>Premise: </strong> {{ $story->premise->toHTML() }}</p>
or, could I just do this inside the blade file?:
<p><strong>Premise: </strong> {{ Markdown::convertToHtml($story->premise) }}</p>
Option 2: andreasindal/laravel-markdown I like this one because it seems really simple, there are blade directives
@markdown($post->body)
and blockstyle:
@markdown
# Hello world
This *text* will be **parsed** to [HTML](http://laravel.com).
@endmarkdown
Seems really easy and straightforward, this is all I really need, so I am leaning towards this option.
Option 3; RobinRadic/blade-extensions I like this because there are a lot of other extensions that look super handy. But it seems to only be current through laravel 5.1 (maybe that doesn't matter?) The markdown directive seems to be the similar to the blade directive noted above in andreasindal's package (I'd need to add a parsedown package and it supports the same one used there).
So, how do you guys do this kind of thing?
Please or to participate in this conversation.