Prism.js with Ruby in Github Pages
After quite a long time, and quite a few blog posts using gists for embedding code samples with highlighting and the rest, I’m giving something else a try.
I’ve added prism.js and a ruby language extension by Sam Flores.
Here’s the quick and dirty way to add prism.js to your own blog (or in my case, Github Pages).
- Add prism.js and prism.css
- Add prism.ruby.js
- Link to both in your layout
And then just write some code inside <pre><code class=”language-ruby”> tags!
class Cow
def says
puts 'moo'
end
end
Cow.new.says #=> moo
Simple as that! I’m gonna give it a try for a little while. Let me know how you think it looks, and how the code reads for you. Thanks!