How to add class="CodeRay" in Octopress

257 Views Asked by At

I am using kramdown in Octopress for a while. I wanted to add CodeRay to my Octopress. I installed coderay.

➜  octopress git:(source) ✗ sudo gem install coderay
Password:
Successfully installed coderay-1.0.9
1 gem installed
Installing ri documentation for coderay-1.0.9...
Installing RDoc documentation for coderay-1.0.9...

I changed _config.yml

markdown: kramdown
kramdown:
  use_coderay: true
  coderay:
    coderay_line_numbers: table
    coderay_css: class

I have added sass/custom/_coderay-github.scss and I can see them in my CSS.

I used the followings but none of them added tag to my html so that it does not render CodeRay css.

~~~
def hello
  puts "hello world"
end
~~~
{:lang="ruby"}

Indented:

    puts "hello world"
{:lang="ruby"}

How can I add CodeRay to my Octopress?

I am following this post.

1

There are 1 best solutions below

0
On

Ok, I found the answer in this page.

~~~
def what?
  42
end
~~~
{:.language-ruby}

Or

~~~ ruby
def what?
  42
end
~~~