Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bagwaa's avatar
Level 12

Markdown Editors

What are people using to implement markdown in Laravel apps at the moment? I have seen a few, but want something quite simple, basic that just lets me throw some MD into text areas.

0 likes
29 replies
bagwaa's avatar
Level 12

interesting, will take a look.

thanks

alfonsan's avatar

I've never understood this Markdown thing that's growing everyday, so I wish you can help me with it.

I get it's easy, you don't have to press buttons, you don't have to leave the keyboard, it works easy with plain files you upload those files to the server and they work, etc...

But it's something users have to memorize. It's something technical. It's a new UX experience that's not what user expect (word/pages style editor aka WYSIWYG).

I understand it makes a perfect fit for this web. It fits perfectly with Jeffrey working style. But I don't understand why people are pushing regular non technical users into using MD or Github's enhanced MD.

Am I missing something?

2 likes
mikebronner's avatar

I tend to agree that markdown only makes sense if the users already embrace it outside of the context of the site.

I am using ACE as well as EpicEditor in one of my projects, but will change that if there are better alternatives. :)

tomschlick's avatar

MD is a representation of how you would logically structure a document if all you had to work with was text.

For instance putting a - then a space before list items, a heading with a line break then a few dashes, making text more noticeable by wrapping it with * etc

1 like
JeffreyWay's avatar

If I were building a regular client's app, I wouldn't bother with Markdown. But, for a developer-specific site, it's a no-brainer. Takes five minutes to memorize the symbols.

8 likes
bagwaa's avatar
Level 12

the people using this app are actually developers who are submitting work they have done, so in that context I think it fits quite well, what I wanted to steer clear of is things like TinyMCE, I still have bad dreams about that thing.

CraftThatBlock's avatar

Wow thanks a lot @foxted. Probably one of the nicest WYSIWYG editors I've seen in a while, but does it support markdown? Because a WYSIWYG Markdown editor would be probably the best thing in the world, merging the gap between developer and user.

1 like
fideloper's avatar

Hey @jeffreyway did you take steps towards stripping HTML people might add in (inside and outside of code fences)?

This has been an issue I've worried about but haven't bothered looking into yet :D

Since Markdown allows arbitrary HTML, you can conceivably strip_tags on when there's input, but I think you need to find a way to ignore HTML tags that might be in code brackets...

fideloper's avatar
alert('hi');
<strong>this is html inside of code fence</strong>

(Looks like you figured it out in any case!)

fideloper's avatar

@CraftThatBlock I don't think it's that simple, because HTML in the code fence would also get stripped before going through the markdown parser.

JeffreyWay's avatar

@fideloper - Once Markdown converts your reply, it'll turn all HTML tags within pre tags into their entity counterparts. So, that allows me to then do another sweep and strip out any unwanted tags that the user might have manually added (though I allow some).

class ReplyParser {

    /**
     * @param $body
     * @return mixed
     */
    public function parse($body)
    {
        $body = $this->stripTags($body);

        $body = $this->stripStyles($body);

        $body = $this->createHyperlinks($body);

        $body = $this->createLaracastsProfileLinks($body);

        return $body;
    }

    // ...

It probably still needs some tweaking, but we'll see.

3 likes
CraftThatBlock's avatar

@fideloper I meant a WYSIWYG editor like TinyMCE, CKeditor, Textbox.io, etc, that has actually /good/ markdown, and simply and stylish like Summernote.

Never yet found a good one.

akael's avatar

@JeffreyWay Any chance we can see your entire ReplyParser class?

I am building a site that needs the same sort of functionality and would like to compare to see if I can improve what I have.

JeffreyWay's avatar

@akael - Sure, I can send it through, when I'm back at my main work computer. It's mostly a few methods containing regular expressions, to filter out all the stuff I don't want.

1 like
Devon's avatar

@JeffreyWay, I'd also like to see that class! I'll be doing something similar within' the next week or two and it'd be nice to not have to reinvent the wheel. :)

Also, is there a reason you went with EpicEditor client-side instead of markdown-js or sending an AJAX request to parse it server-side?

harryg's avatar

There's the Pagedown Bootstrap editor that works just like the Stackoverflow editor. It's nice because it shows a live preview beneath using the pagedown library.

It's purely client-side so you can save raw markdown on your backend and parse it to html when it's rendered - either client or server side.

michaeldyrynda's avatar

We use Redactor for work projects, which is licensed (and what Summernote is based on). It's clean, looks good, and works well. Unfortunately, no markdown support built into it, though.

xingfucoder's avatar

Hi friends, anyone of you are using vtalbot/markdown package within Laravel 5?

@JeffreyWay you are using that package? In the composer.json it specifies the laravel 4 version as a requirement. Could you recommend me this package for L5 projects or do you recommend me another package?

Thanks in advanced.

xingfucoder's avatar

Many thanks both of you. I have switched to league/commonmark too and it works fine.

Thanks in advanced.

Please or to participate in this conversation.