Introducing: Code Snippet Library

Sharing code snippets is a common need for sites like mine. Whether you run a full tutorial site, or a blog on which you occasionally post code tutorials, you’ll need some way of managing your snippets. My solution for this need is Code Snippet Library.

What is it?

Code Snippet Library is a plugin that allows you to create and store a library of code snippets in your WordPress site. It uses the Ace code editor (just like GitHub) and supports 61 programming languages and all the themes that come packaged with Ace. The snippets can be displayed any number of times using a shortcode.

Snippets are managed using WordPress’ taxonomy UI, which, in hindsight, wasn’t the best decision for this plugin as I think using the post type UI would be a much better way of handling things. It works well, but it might be worth rewriting the plugin at some point in order to make it more robust and practical.

Who is it built for?

The main target market for this plugin is anyone who runs a code tutorial site, but it can be used by anyone who wants to share code snippets on their site.

Why did I build it?

Sharing snippets of code on websites isn’t new, nor is it something that requires yet another plugin to achieve. That being said, at the time that I wrote this plugin I was looking for a way to store code snippets on my site that I could use as many times as I wanted to. WordPress Code Snippet was a plugin that did just that, but it used a custom UI and stores the snippets in a custom database table, which was not ideal. Code Snippet Library was my way of handling this the WordPress way.

After a while of using this plugin myself, I have switched to storing my snippets in Gist and then using oEmbed Gist to display them on my site. Maybe that’s not the best advert for my own plugin, but hey – Gist is more practical for me now.

[wp-pic type=”plugin” slug=”code-snippet-library” align=”center” layout=”large”]

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s