Google makes formatting codes a breeze in Docs

Posted on

Google Docs is getting a new feature that makes it easier to display code in an easy-to-understand way. The company announced it was adding blocks of code to its “smart canvas” system, which automatically adds correct spacing and color coding for various programming languages, such as Python, C, and Javascript.

Previously, getting the code to look good in Google Docs required workarounds or add-ons, which weren’t necessarily the most useful. While that wasn’t the end of the world, it’s important to make sure code is rendered correctly for documentation, and having different parts of the code displayed in different colors makes it much easier to read if there’s more than a single line or two.

Gif of someone formatting a few lines of code using Google Docs code blocks.

Doesn’t that look much nicer?
GIF: Google

Google says you can access the feature by going to Insert > Building Blocks > Code Block, then selecting the relevant language. You can also type “@project assets” into your document to bring up the menu, similar to how you would bring up the emoji picker.

The feature may take a while to roll out — according to Google’s blog post, some people may not even have it by January 18, depending on their Workspace settings — and it will only be available to people on specific subscription levels. If you’re using a personal Google account, legacy G Suite account, or various Essential and Starter Workspace tiers, you won’t be able to access them, according to the company’s press release. That’s a bit of a bummer for hobbyist coders trying to write instructions for their APIs, though I must admit this feature seems to be most useful for larger companies.

Leave a Reply

Your email address will not be published. Required fields are marked *