Using Highlight.js in Blogger

First posted on 12/01/2014

Applying highlight.js is pretty simple in Blogger. Here is a simple guide on how to install it.

  1. Go to your Blogger "Template" settings
  2. Go to "Edit HTML"
  3. Add the following line below <head> tag:
<link href='' rel='stylesheet'/>
<script src=''>
  1. Use Highlightjs by wrapping your code in <pre><code>YOUR CODE</code></pre> like so,
<pre ><code >
def somefunc(param1='', param2=0):
    r'''A docstring'''
    if param1 > param2: # interesting
        print 'Gre\'ater'
    return (param2 - param1 + 1 + 0b10l) or None

class SomeClass:

>>> message = '''interpreter
... prompt'''

Make sure to escape your code first using HTML Entities Encoder.
I've hosted the themes in my Google Drive. Read this tutorial for more information on how to use the hosted themes.

Show Comments

Get the latest posts delivered right to your inbox.