There are a lot of great parameters that can be used to configure the code box features which include highlighting specific lines, controlling the line wrapping, and collapsing the code box on page load, to name a few.

Embedding GitHub gists

Source code highlighting is great, but sometimes it’s nice to have revision history so that readers can see bug corrections. Gists are great throw-away Git repositories that can be used for snippets and pastes. Gists also have the added benefit of being portable. If you ever outgrow wordpress.com, you can take your code snippets with you.

Gists are normally embedded on a site using javascript. I was excited to try it out, but was disappointed to discover that wordpress.com does not allow inline javascript to be added to posts. After searching a bit, I discovered that a gist shortcode was added specifically for embedding gist source code in WordPress posts.

Embedding all gist files

A gist can easily be embedded in a post using

[gist https://gist.github.com/4554439 /]

Which produces

Embedding individual files from a gist

A neat trick that isn’t listed on the WordPress gist support site is the ability to embed individual files from a gist.