Pages

Wednesday, September 2, 2015

Add code snippets easily in your blogs using GitHub

It's obvious that there are numerous ways and tools available to include your code snippet in the blogs. Each having their own pros and cons. What do you want as a programmer who wants to simply share your knowledge? You will be interested to do this without much hassle and also to let the readers view and copy the code easily.

Here are the five easy steps to do this using GitHub:

  1. Go to https://gist.github.com/
  2. Put appropriate file name in the name this file... area. Make sure to put correct extension, so that GitHub will show proper syntax formatting.
  3. Paste the code & click on Create Public Gist button
  4. Copy the url from the Embed this gist area. Eg: <script src=\"https://gist.github.com/abcd.js\"></script>
  5. Paste it simply in your blog. That's it guys!