If you are an author writing technical blogs you know the problems:
- the rich text editors doesn’t support editing source code very well
- the most editors doesn’t support tabs (useful for XML)
- often your formatted sourcecode will be shot
But now we are living in the age of social coding. Since GitHub we are knowing that our code can be forked, commented and reviewed by all users in the internet
But GitHub has another nice feature named GIST. A Gist is a repository containing one or more code snippets. This is versioned like your other sourcecode and every Gist is public and can be used as simple code in your blog posts.
WordPress and Gists
If your are using WordPress as blogging software you can easily integrate your gists. If you search for Gist plugins you will find some: http://wordpress.org/extend/plugins/search.php?q=gist
Eclipse and Gists
The current release of Egit (the Eclipse integration of GIT) offers a GitHub integration. And additionally Gists are supported, too. You can add your Gists with Mylyn and attach and remove files to/from your gist.
IntelliJ 11 has Gist support, too.
Working with Gist
There are some steps to do to use gists in your blog:
- Login into the Gist area of GitHub (you can use your GitHub account)
- Create a new Gist
- Add one or more files (code snippets)
- Embed this in your blog post:
if you have only one file or
[gist id=12345 file=myfile.txt]
if you want to specify a file directly
- Thats all!
Working with Gist without plugin
You can use your Gists without any plugin, too. It’s quite simple. Add this snippet to your page: