Sunday, December 13, 2020

Make you blogger posts colorful with highlightjs

Long time ago I started blogging about tech stuff and changed a lot of platform from wordpress to my own hosted blog and for some reasons I started using blogger with my custom domain and when it comes to add code snippet in the posts, github's gist feature was my first choice but it involves writing snippet and adding its reference into my blog which is more than one step process. For that reason I recently explored highlightjs for code highlighting in my posts and it works great. The configuration is easy 1 step process. Configuration: To configure highlightjs into blogger, just go to the theme option in your blogger control panel and click customize. After that in the page header add following script:


<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/styles/atom-one-light.min.css"
rel="stylesheet"></link>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
And you have successfully configured it.


To utilize that add you content inside <pre><code>...</code></pre> and it will be highlighted.

No comments:

Post a Comment

Lets play with cypress - Part 2

 In the first part I explained starting of my automation journey with first command to setup cypres at the end i.e.  npm install cypress -g...