Search This Blog

2016/09/26

Make higher color codes in blogger by [highlight.js].

When I write codes in blogger, I want to make higher color with code likes eclipse or Sublime Text. So I try to use highlight.js in blogger.

As google drive is stop hosting file for website, it turns to copy&paste code in blogger template or use a prebuilt version of highlight.js hosted by CDNs.

Copy and paste the code below inside of <head></head> in blogger template. (Before you edit your template, it's better to make a backup)
<link href='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/default.min.css' rel='stylesheet'/>
<script src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js'/>
<script>hljs.initHighlightingOnLoad();</script>

Then, just need to put the codes inside tag <pre><code>...</code></pre>. (You need to edit in HTML mode)

Check the example site: SFDC