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.

Is there way to switch on syntax highlighting in Google Docs?

Personally I use it for editing and collaborating on C++ files, but PHP or SQL syntax highlighting also would be interesting.

share|improve this question
add comment

migrated from superuser.com Sep 22 '11 at 19:34

This question came from our site for computer enthusiasts and power users.

8 Answers

With the new Add-Ons for Google Drive, you can get code highlighting with the Code Pretty add-on.

share|improve this answer
add comment

Vim can output its syntax-highlighted buffer to an HTML file:

http://vim.wikia.com/wiki/Pasting_code_with_syntax_coloring_in_emails

or this one is also nice:

http://superuser.com/questions/565050/export-file-syntax-highlighting-to-html-using-vim

This file can be opened in your browser, from where you can copy and paste the text over to Google Docs/Drive.

share|improve this answer
add comment

Well there is a web app that was projected to be included on Google Docs but got canceled :/ It's name is Collide. You can see it in action here

share|improve this answer
1  
It doesn't help much to give an answer that offers a solution that is already been cancelled. Our goal on all of the StackExchange Network is to provide helpful and relevant solutions. One way to help is to think if you asked the question would you like an answer that tells you that there was almost a solution but it was cancelled, however, you can still see what it would have been like "here". –  Bradley A. Tetreault Oct 24 '12 at 16:12
1  
My mistake, it got canceled 'by google' but now is an open source project. Check the Collide link. –  P3t3rU5 Dec 23 '12 at 17:42
add comment

For something simple try rextester. It allows to collaborate real-time on code snippets written in many languages. Go to 'run code', choose your language and then hit 'Live cooperation' button.

share|improve this answer
    
Why would someone want to choose that option? –  Al E. May 23 '12 at 17:48
    
@Al Everett Because it allows to collaborate on code snippets real-time. Although this doesn't answer the question directly, but suggests an alternative. –  ren May 23 '12 at 20:26
    
Then please edit your answer to include that information. –  Al E. May 24 '12 at 13:04
add comment

Try this one. Implementation of "Eight Days of Malaise" idea.

  1. Open www.Snipt.net and Sign Up for new account.
  2. After signing in click on the Add Snipt button.
    enter image description here
  3. Write your code in given area, select appropriate language from drop down and click save button.
    enter image description here
  4. You can see in below image that your code is colourized. Select this colourized code and copy it.
    enter image description here
  5. Paste this code into Google Docs (Google Documents of Google Presentation). Here is the result.
    enter image description here
share|improve this answer
3  
Thanks. Important note though is that I am working in Firefox and to get this working I had to copy the snippet using Snipt in Chrome. Copying the snippets from Firefox, Internet Explorer or Opera did'nt work, they all just return plain text. –  Spiralis Nov 29 '12 at 9:47
    
thanks! very well demonstrated. –  user219628 Jun 10 '13 at 19:32
    
@Usman Farooq, please add to the answer (and your blog post: usmanfaroooq.blogspot.de/2012/04/…) that the only browser that supports the feature is Chrome –  Tim Apr 2 at 12:10
add comment

No. For programming online when out and about, check out Mozilla Bespin

EDIT: Mozilla Bespin is dead, it was merged in Cloud 9 IDE.

share|improve this answer
    
I don't need hosting for whole project. I need to share one or two files. Google Docs is very simple to use and appropriate for that purpose. Except for syntax highlighting. –  Kirill Jul 21 '09 at 14:08
    
Then only put on or two files on Bespin. Google Docs does not support syntax highlighting at all (and i cannot see if supporting it in the future) –  David Pearce Jul 21 '09 at 14:47
    
Have to agree here, it's not really within the scope of Google Docs. –  Stefan Thyberg Jul 21 '09 at 20:39
    
Bespin project are no longer exist. Cloud9 IDE, in which Bespin was merged by the moment of writing this supports only javascript. –  om-nom-nom Mar 7 '12 at 13:05
add comment

You can make use of the the question or answer fields on Stack Exchange sites to help out.

  1. Paste your code snippet into a blank text field.
  2. Select it, and use the "code sample" (the one with curly braces) button to ensure it gets formatted as code.
  3. Wait a little while to let the syntax highlighting to do its thing.
  4. Copy the previewed question/answer code-block.
  5. In your Google Doc, on a new line, set the paragraph style to block-quote.
  6. Paste the previewed code-block.
  7. That's it.

Google Docs seems to reset the font for some reason, but preserves the syntax highlighting. Good for including code snippets into documentation.

share|improve this answer
3  
That's very tedious, and you'd have to go through this process again every time you make any non-trivial change to your code. –  musicfreak Feb 10 '10 at 23:05
add comment
up vote 12 down vote accepted

I've found codepad.org which allows to share code snippets. It supports syntax highlighting and even compilation of code. And it supports wide range of programming languages — C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Python, Ruby, Scheme, Tcl. And one more great feature — it does not require to login.

share|improve this answer
add comment

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.