Sani Syntax Palette is a Google Slides™ and Google Docs™ add-on that applies syntax highlighting to source code and pseudocode inside the file you have open.
What this add-on does: you can select code in a Google Slides™ presentation or a Google Docs™ document and apply colour to its keywords, strings and comments. It supports C, C++, Python, JavaScript and pseudocode; in pseudocode, variables become italic and keywords become upright and bold. It is free.
Currently under review on Google Workspace Marketplace™.
Works on code already in the document, and on code you paste in.
Select code already typed into the document and the formatting is applied in place. Useful for cleaning up lecture notes or assignments you have already written.
Paste code into the sidebar and it is highlighted and inserted at the cursor. You can add a background block behind the code at the same time.
Uses the Light+ and Dark+ colours from Visual Studio Code, down to giving control-flow keywords a different colour from declaration keywords.
If you do not pick a language, the add-on infers it from the code. Strings, comments, numbers, function names and types are each distinguished.
def solve(nums): total = 0 # running sum for i, v in enumerate(nums): if v % 2 == 0: total += v return total
In pseudocode, keywords and variables are distinguished by typeface rather than colour.
maxScore(x[], n): best ← x[1] for i ← 2 to n if x[i] > best then update the maximum return best
| Element | Style |
|---|---|
| Variable and array names | Italic |
| Keywords | Upright and bold |
| Numbers and procedure names | Upright |
| CJK text | Upright — Korean, Chinese and Japanese have no italic forms, so they are left alone |
| Body font | Chosen in the sidebar (Courier New by default) |
The keyword list is editable in the sidebar.
Your edited list is saved to your account and kept the next time you open a document, and matching
is case-insensitive. When code is inserted, <- <= >=
!= are converted to ← ≤ ≥ ≠.
Nothing is collected.
| Scope of access | The single document you currently have open. No other file in your Google Drive™ can be reached |
| Transmission | None. All processing runs inside your own Google account |
| Storage | Document content is never stored. Only your own display settings, such as the keyword list, are kept |
| Analytics and tracking | None. No usage data is collected |
An install link will be posted here once the Google Workspace Marketplace™ review is complete.
| Supported hosts | Google Slides™, Google Docs™ |
| Price | Free |
| Permissions required | Access to the current document; display of a sidebar |
Questions and bug reports are welcome.
This add-on came out of the friction of preparing computer science course material. It covers C, C++, Python, JavaScript and pseudocode.