When it comes to embedding source code into posts, I’ve been a fan of the SyntaxHighlighter plugin by Alex Mills for a long time – I’ve used it on every programming blog that I’ve maintained for as long as I can remember.
But ever since GitHub rolled out Gists, I’ve been using those to store frequently used functions, examples of code for posts or other articles, and snippets for which I’d like to have others come in introduce their changes, and/or their comments.
Straight from the Gist homepage:
Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.
Easy enough, right?
Perhaps one of the cooler things about gists is that they can be embedded in WordPress posts; however, I’ve had mixed success with the native support in doing that.
But Michael Novotny’s WP Gist plugin makes it really easy to embed nice-looking, gist-specific code into a WordPress post.
Get The Gist in WordPress
From the website:
- Add GitHub Gist embeds to WordPress posts and pages with a shortcode.
- Support for displaying a specific file within a Gist that has multiple files.
- Adjusted styles to make GitHub Gist embeds look good with nearly any theme.
In short, WP Gist makes it really easy to embed GitHub Gists into your site (and do so without breaking any styles), but one of the things that I love the most about the plugin is that it allows you to include only a specific file from a gist.
For example, I used this feature in a recent post when talking about the WordPress Theme Customizer. Specifically, the Gist is made up of three different files each of which I needed to include at different times.
But WP Gist made it that much easier to draft the post.
Download WP Gist
For usage instructions, how to install the plugin, or even to contribute to it, you can check out the GitHub project page; otherwise, download the plugin.
Leave a Reply
You must be logged in to post a comment.