Saturday, September 15, 2012

Embedding Code Snippets in a Blog

Recently I have been searching for an easy way to put snippets of code in blog posts which is also attractive looking (including syntax highlighting etc).

I think embedding code from gist is a very convenient way to do it.

These are the steps to do exactly that :
  1. Go to
  2. Past the code you want to post (add optional descriptions and file name)
  3. Click on "Create Public Gist"
  4. Click on "Embed All Files : show embed"
  5. Copy the embed tag HTML code
  6. Go back to blogger and create a new post
  7. Select "Edit Html" 
  8. Paste the embed tag anywhere into your post.
Thats it!  This is my C++ Hello World program :

No comments: