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 :
- Go to http://gist.github.com
- Past the code you want to post (add optional descriptions and file name)
- Click on "Create Public Gist"
- Click on "Embed All Files : show embed"
- Copy the embed tag HTML code
- Go back to blogger and create a new post
- Select "Edit Html"
- Paste the embed tag anywhere into your post.
Thats it! This is my C++ Hello World program :
No comments:
Post a Comment