GitHub Gist

As a blogger about software, I often want to actually post code in my blog posts. There are multiple ways to do this, and each one has it's merits. The things I wanted were:

  • Basic syntax highlighting
  • Easy to type and read the code in the editor
  • Easy to read the code in the post
  • Easy for the reader to copy the code to use

I used to host my blog on wordpress, and tried no less than 5 different code-highlighting plugins, and none of them worked well. I had to specify special tags and languages and the code always looked awful in the editor. Enter GitHub Gist.

It's super easy to just type/paste my code into a Gist and just embed the code in my post. Here's an example of one I made for another post. All I type into my post editor is the embed script, given to me by Gist:

<script src=""></script>

And the output is this:

Not only can I specify the language (quick tip: type the filename like somecode.cs and it' guesses the language based on the exension), but it does highlighting, the editor works really well, and users can fork the code, because each one is it's own little repository. I wish I'd been using it all along.