Markdown Not Completely Working

Today I decided to give cebe’s markdown a try and I couldn’t get it to fully work. I used github markdown and when I try to display some code specific syntax all I get is <pre> formatting. Do I have to explicitely register additional assets in order to get code syntax displayed properly? I tried this


var s = "JavaScript syntax highlighting";


taken directly from github cheatsheet but all i get is grey background with text (no code specific highlighting). I wonder if I am missing anything. I read through the documentation and couldn't find any info about it except for how to parse it on Yii side.


There are some differences between traditional markdown and github-flavoured one.

Thanks for the quick reply ORey. Still there something wrong somewhere.

I tried:


require 'redcarpet'

markdown ="Hello World!")

puts markdown.to_html


function test() {

  console.log("notice the blank line before this function?");


both copied from the link you provided and both give me the same result. No ruby specific highlighting. It is either I am missing something or the markdown extension is not fully working or missing instructions.

I also checked in the console and I can see the following code:

<pre><code class="language-ruby">require 'redcarpet'

markdown ="Hello World!")

puts markdown.to_html


so the language specific class has been applied. It seems like only the assets are missing.

I see.

First of all, seems like github syntax is actually supported:

// use github

$parser = new \cebe\markdown\GithubMarkdown();


and here’s the example of extending for fenced code blocks:

Sorry, I havent used it by myself yet, but seems like it’s highly customizable.

I think Carsten Brandt can shed some light on it.

You need to add a syntax highlighting JS plugin separately (cebe’s parser does not include the syntax highlighter). This is discussed in this issue.

Highlighting is to be implemented. Currently the best option is to use something like

Thanks guys.

@samdark, why is this the best option? maturity? stability? ease of use? Thanks

Because it doesn’t require to modify markdown parser + library itself is of very good quality. We’re considering using its PHP port by default.