How to add syntax highlighting to Jekyll Sites
Jekyll supports syntax highlighting by default using gem rouge
. It can highlight 100 different language.
You need to add one line in config.yml
and need to ensure that rouge
gem is installed. If you have forked any Jekyll site then you can skip this step, else run:
Themes: There are many themes available for syntax highlighting. They can be previewed here. They can be downloaded from here.
I personally prefer Github flavoured theme which I downloaded from here.
Once you have decided the theme then you can replace the file _syntax-highlighting.scss
file located in _scss
directory. Every Jekyll site must have this file by default.
Please see below some of the use cases.
Ruby:
Python:
HTML
2025-01-12
Jun 2019