Sani Syntax Palette

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.

Google Docs™ · Slides™ C · C++ · Python · JavaScript Pseudocode typesetting Free
Install

Currently under review on Google Workspace Marketplace™.

Features

Works on code already in the document, and on code you paste in.

Apply to existing code

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.

Insert new code

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.

Visual Studio Code themes

Uses the Light+ and Dark+ colours from Visual Studio Code, down to giving control-flow keywords a different colour from declaration keywords.

Automatic language detection

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.

Python · Dark+
def solve(nums):
    total = 0              # running sum
    for i, v in enumerate(nums):
        if v % 2 == 0:
            total += v
    return total

Pseudocode typesetting

Follows the notation used in algorithm textbooks. It distinguishes elements by typeface rather than colour, so it suits printed handouts and submitted work.

Pseudocode · Light+
maxScore(x[], n):
    bestx[1]
    for i ← 2 to n
        if x[i] > best then update the maximum
    return best
ElementStyle
Variable and array namesItalic
KeywordsUpright and bold
Numbers and procedure namesUpright
CJK textUpright — Korean, Chinese and Japanese have no italic forms, so they are left alone
Body fontChosen 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 .

How your data is handled

Nothing is collected.

Scope of accessThe single document you currently have open. No other file in your Google Drive™ can be reached
TransmissionNone. All processing runs inside your own Google account
StorageDocument content is never stored. Only your own display settings, such as the keyword list, are kept
Analytics and trackingNone. No usage data is collected

Read the full privacy policy →

Install

An install link will be posted here once the Google Workspace Marketplace™ review is complete.

Supported hostsGoogle Docs™, Google Slides™
PriceFree
Permissions requiredAccess to the current document; display of a sidebar

Developer

Questions and bug reports are welcome.

Sani

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.

Contact
dinosinfolee@gmail.com
Website
syntax-palette.sanskit.com
Product
Sani Syntax Palette