Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I use Google Drive Docs as my note taking tool and it is awesome since I can use it when I am offline, but I have a problem: I can't add source code in documents there. I know this question is answered here, but Google documents have changed a lot and the solution given there is not working properly. Can anybody suggest a suitable way for it?

share|improve this question
    
Do you need it to be styled? –  Jacob Jan Tuinstra Dec 24 '12 at 18:11
    
That linked answer just says that you need to paste a formatted code and then change the font. It still works. If you need colored codes, then you can copy paste the code from, say, Github or some other site where the code is presented as color-coded. –  Bibhas Dec 25 '12 at 22:13
    
Have a look at this answer: webapps.stackexchange.com/a/37830/29140. Perhaps it is of use: –  Jacob Jan Tuinstra Jan 27 '13 at 11:18
    
possible duplicate of How can I get code syntax highlighting in Google Docs? –  Vidar S. Ramdal Apr 25 at 8:04

1 Answer 1

Convert your source code to HTML using a text editor such as Vim or Emacs, and then paste the resulting HTML into your Google Drive.

This method has the added benefit of being available while offline, which -- from your question -- also seems to be important to you.

In Vim, use the ":TOhtml" command. (In gVim, use "Convert to HTML", on the Syntax menu.)

In Emacs, use htmlize.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.