Sani Syntax Palette is a Google Docs™ and Google Slides™ add-on that applies syntax highlighting to source code and pseudocode inside the document you have open.
What this application does: you select code in a Google Docs™ document or a Google Slides™ presentation, and Sani Syntax Palette colours its keywords, strings and comments so the code reads the way it does in a code editor. It supports C, C++, Python and JavaScript, and it typesets algorithm pseudocode in the notation used by textbooks — variables in italics, keywords 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
Follows the notation used in algorithm textbooks. It distinguishes elements by typeface rather than colour, so it suits printed handouts and submitted work.
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, because notation differs from textbook to textbook.
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 Docs™, Google Slides™ |
| Price | Free |
| Permissions required | Access to the current document; display of a sidebar |
Questions and bug reports are welcome.
This add-on grew out of the friction of preparing algorithm lecture material. Typesetting pseudocode the way textbooks do is the part that matters most.