Jekyll and syntax highlighting
Jekyll has a great support for syntax highlighting, by default, Jekyll utilizes Rouge⇗, which is a pure ruby-based code highlighter. Rouge can highlight 100 different languages⇗.
Code formatting can be done with {% highlight ruby %}
.
As you can see, you especify the language right there, even line numbers are supported by adding linenos
, ending with something like like:
{% highlight ruby linenos%}
A full run would be like:
1
2
3
4
5
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
Check out the Jekyll docs⇗ for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll’s GitHub repo⇗.
If you liked this post, you can share it with your followers⇗ and/or follow me on Twitter!