Note: One alternative is to use this Prism.js Jekyll Plugin, the advantage of using google-code-prettify is that it can be used with standard markdown (indented code blocks) rather than using liquid tags like {% prism %}
. Prettify will guess which language your code blocks contain and highlight appropriately.
Grab the google-code-prettify sources and include them in the <head>
of your page template, for Jekyll you will want to edit layouts/default.html
(tailor paths to directory structure):
<link rel="stylesheet" href="/css/google-code-prettify/prettify.css">
<script src="/js/google-code-prettify/prettify.js"></script>
This JS snippet adds the prettyprint
class to <pre>
tags and runs prettify: