If you are reading this article then it means you know what syntax highlighting is..isn’t it ?

Okay..if you dont know,no problem this article is not for you.

If you are a coder-cum-blogger then I am sure you might be using some plugin for highlighting syntax.such as syntaxhighlighter,crayon-syntax-highlighter and many others.

Did you know these plugins slow down your website ? Yes these plugins loads javascript every time your website is loaded even if the page doesn’t contains any code for highlighting.

It also have some other shortcomings like support for limited number of programming languages .For example you cant find syntax highlighter for highlighting Arduino codes.Even though it is derived from C it does have some own functions.so these syntax highlighters doesn’t highlight those lines.

So what is the solution ?

Yes I have a solution.Using Github Gist is the smart way to overcome the problems of existing syntax highlighters.

Why Github Gist ?

It is like a repository for small code snippets,You can add any number of snippets and you can easily embed the code to your blog post.It also have a support for highlighting many programming languages.You can even get support for highlighting some of the newest and less popular programming languages.

Though it may seem you are spending much time..but once you know how to do it you will be more productive and I bet its worth spending time on it.

I have given a step by step guide with screenshots.

1. Create a Github account here.

2. Once you successfully created it ,head on to Github Gist

3. Now you will get some fields to create your first gist.

  • Enter code Your description in the Gist description field
  • Enter the name of the code with the file extension at the end so that it automatically assigns the programming language.for example my-code.c or mycode.php etc.
  • Now paste or type your code.Note that at this point your code won’t be highlighted.
  • at the bottom of the page you can see two option.To create secrete Gist and Public gist.Make sure that you create a public gist.otherwise you cant able to showcase the code to others.

Creating a Github Gist

  • Now you might got your gist created with lighted code.Copy the gist URL.


Even though you get an option to embed the Gist you cant embed it into your Wordpress,since the embed code itself a javascript code.

4. You need to Download and Install the plugin called : Embed GitHub Gist.

Now you can ask me a question..We are still using a Plugin ?

Yep but there is a lot of difference in that.This plugin doesn’t load any javascript.The code will be loaded explicitly from Github and it will only load in the page you embedded the code.

If I am still unable to convince you,go and look at the blogs of WordPress geeks like Brian Gardner of studiopress and Bil Erickson.

5.Now you can embed the code in your Wordpress post by using any of the following shortcodes

Github Gist Embed shortcodes

Github Gist Embed shortcodes

I normally use the last one,Since I can easily remember that short code.

Here you can see the output

body {
  font-size: 14px;
	font-size: 1rem;
	font-family: Helvetica, Arial, sans-serif;
	text-rendering: optimizeLegibility;
	color: #444;
body.custom-font-enabled {
	font-family: "Open Sans", Helvetica, Arial, sans-serif;

I hope this article will let you uninstall your current syntax highlighting plugin.

Do you feel this article is worth sharing ??…then Share it to your social circles and subscribe our newsletter below.

Lets continue to discuss about this topic through the comment form below.


  1. Mike Bethany says

    The problem with GitHub’s Gist is the display is enormous. Sometimes I just want to display one or two lines of code and that box is gigantic. Also I have no control over the look and feel of the display.
    Mike Bethany recently posted…Completely Delete Your Hibernate FileMy Profile

  2. says

    Thanks for this Vivek
    Just signed up and created Gists for a few pieces of code that I used in a post.

    Downloaded plugin and tried the shortcodes on a local install and they worked a treat.

    Will add gists to live site tomorrow and get rid of the Syntax Highlighter plugin.

    Thanks for showing me how.

    • says

      I normally don’t use Github Gist unless its a HTML or short code which renders when I publish the article. So I don’t think using Github Gist will make any difference.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge