Highlight Code Syntax using Highlight.js
Here is how you can add syntax highlighting to your Ghost blog using highlight.js:
Add the highlight.js script and CSS file to your
Initialize highlight.js also in your
- Restart Ghost.
Now, when writing a post you can use regular markdown and highlight.js will work, but it will attempt to choose the language itself. Sometimes it can choose wrong though, so I find it best to just use actual HTML and specify using the classes which language you want. Here is an example of both:
- After saving go to the post and you will see that the syntax has been highlighted!