Add syntax highlighting support for additional languages in the Caffein Ghost theme

Michael Lehmann
Michael Lehmann14 March 2021

I just setup my new Ghost blog and recognized the missing support for the C# programming language. C# is my main programming language and plan to write some post about my work with it.

With hat in mind I searched a way how to add the syntax highlighting support for additional languages. I'm using the Caffein Theme for the Ghost platform. The theme uses PrismJS to introduce syntax highlighting for code snippets.

Prism has a plugin called "Autoloader". Autoloader will dynamically load the language used in code blocks. I did not want to make big changes to the theme, but Luckily Ghost allows to inject code on the index page. Add the following code to the site footer code injection:

<script src=""></script>
<script src=""></script>
<script>Prism.plugins.autoloader.languages_path = ''</script>

With that change, the syntax highlighting should now also work for languages like C# by specifying the language on the markdown code block.