up vote 14 down vote favorite
2
share [g+] share [fb]

Is there way to switch on syntax highlighting in Google Docs? Personally I use it for editing and collaborating C++ files, but PHP or SQL syntax highlighting also would be interesting.

link|improve this question
feedback

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

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

3 Answers

up vote 5 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.

link|improve this answer
feedback

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

link|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) – joshhunt 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
feedback

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.

link|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
feedback

Your Answer

 
or
required, but never shown