22 April, 2012

Syntax Highlighting in Google Docs

Asalam-o-Alaikum!

I use Google Docs to make my programming notes. For which I have to write some code examples. As you know that writing code requires the syntax to be highlighted. But unfortunately, Google Docs lacks this feature. So I tried to search for an appropriate solution to highlight my code examples. And I have come across a solution which I am going to share with you. I know that this solution is not perfect, but it works for me :-)

Step 1: Open www.Snipt.net and Sign Up for new account.
Step 2: After signing in click on the Add Snipt button.

Click on Add Snipt

Step 3: Write your code in given area, select appropriate language from dropdown and click save button.

Adding code on Snipt.net

Step 4: You can see in below image that your code is colourized. Select this colourized code and copy it.

Syntax Highlighting on Snipt.net
 Step 5: Paste this code into Google Docs (Google Documents or Google Presentation). Here is the result.

Syntax Highlighting on Google Documents with white background page.
Note: 
  1. If you are feeling difficulty in reading code on Google Docs then make it bold.
  2. Be sure that background of Google Documents or Google Presentation is white. Otherwise the result will be like this...


Syntax Highlighting on Google Presentation with blue background slide.