Google Docs – Code Syntax Highlighting

formattinggoogle docs

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.

Best Answer

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

After installing the add-on, you can access it by selecting the code you want to format, go to _Add-ons → Code Blocks → Start:

Screenshot of invoking the Code Blocks menu item

This pops up a sidebar where you can select the programming language and a theme:

Screenshot of using the add-on

After clicking Format, the result looks like this:

enter image description here