DEV Community

Cover image for Easily Format and Highlight Your Code in Google Docs
Duncan Lew
Duncan Lew

Posted on • Originally published at duncanlew.Medium

Easily Format and Highlight Your Code in Google Docs

Google Docs is a popular word processing tool that allows you to create and edit documents online. Code formatting in Google Docs hasn’t always been an easy task to achieve. If you wanted to put a code block directly into your Google Docs document, you would have ended up with unformatted code with no syntax highlighting. This isn’t always easy on the eyes and is not conducive to quickly scanning your code to get a sense of its purpose. There are other ways to achieve this in a more aesthetically pleasing way, but that meant having to use add-ons as a work-around. But fret no more, Google has got you covered! One of the new notable features that Google just announced is Code Formatting, which makes your code easier to read and understand.

How to use it

Gif illustrating how to use code formatting. Source: Google
To access this code-formatting feature in your current Google Docs document, select Insert > Building blocks > Code Blocks. Afterwards, select the programming language of your choice. It’s also possible to access this feature by typing @project assets in the document and selecting Code blocks.

Availability

According to Google’s post, the code formatting feature in Google Docs will be available to all Google Workspace customers starting on January 3, 2023. Google has not stated yet that they have plans to roll it out to those with personal Google Accounts in the future. Hopefully this will change in the near future.

Wrap-up

Google Docs is constantly getting improved with new features and this time it’s a boon for us developers out there! Code formatting in Google Docs is a useful tool that can help you create documents that are easier to read and understand. Whether you are working on a document that includes a lot of code or just want to insert a few lines of code into your document, Google Docs has you covered. 👨‍💻




If the content was helpful, feel free to support me here:

Buy Me A Coffee

Top comments (1)

Collapse
 
johnlee22 profile image
john lee

Thanks for sharing that is very interesting. It will be worth it on the site All Popeyes Menu to develop a website and create content.