In the current version of Google Docs, contributors who want to present code have to manually highlight and then apply a font or paragraph style after pasting the code into the page. This has been a challenge and a shortcoming of Google Docs, as it was challenging to illustrate that certain text was meant to be programming code.
This is now about to change as Google is introducing a brand new Smart Canvas feature that will make this process far simpler. “Building Blocks” were introduced to Google Workspace as a Smart Canvas feature that provides formatting templates, such as meeting notes, email drafts, etc. Now, there will be a new Building Block type available specific to programming code, which gives you the ability to visualize code with industry standards, making code readable and collaboration much easier.
You will also have the option to choose the programming language you want your code to be formatted in, such as C/C++, Java, Javascript, Python, and Unset. To format and display code in a Doc, select Insert > Building blocks > Code blocks, then choose your programming language.
This is not an attempt to turn Google Docs into an IDE (Integrated Development Environment) to write and compile code, but simply an attempt to improve the formatting of code within a document to differentiate it from standard text. This feature has already begun to roll out to Rapid Release domains with an extended rollout that will potentially take longer than two weeks. Scheduled Release domains will start to see this feature starting on January 3rd, 2023. Availability will be as follows:
- Available to Google Workspace Business Standard, Business Plus, Enterprise Standard, Enterprise Plus, Education Standard, Education Plus customers and Nonprofits
- Not available to Google Workspace Essentials, Business Starter, Enterprise Essentials, Education Fundamentals, the Teaching and Learning Upgrade, Frontline, as well as legacy G Suite Basic and Business customers
- Not available to users with personal Google Accounts