Shuna Maekawa / Projects

Code Annotator — Annotated Code Snippet Generator

2026-03-22 · Web App, JavaScript, Cloudflare Workers, Prism.js, Canvas

Create beautiful, annotated code snippets for documentation, presentations, and teaching — entirely in the browser.

Code Annotator — Annotated Code Snippet Generator

Overview

Code Annotator is a fully client-side tool for creating annotated code snippets. Select any text in your code, attach annotation cards with rich formatting, position them freely on a canvas, and export the result as a PNG — all without leaving the browser.


The Problem

Explaining code visually is surprisingly tedious:

I wanted a single tool where I paste code, select text, write annotations, and export — done.


Features


Tech Stack


How It Works

┌──────────────────────────────────────────┐
│  Code Input (Prism.js syntax highlight)  │
├──────────────────────────────────────────┤
│  Select text → Create annotation card    │
│  ┌────────────────┐                      │
│  │ Annotation     │◄── Rich text editor  │
│  │ with arrow     │    (bold, italic...) │
│  └────────────────┘                      │
├──────────────────────────────────────────┤
│  Canvas layer: drag, resize, position    │
├──────────────────────────────────────────┤
│  Export → PNG (client-side)              │
└──────────────────────────────────────────┘
  1. Paste or type code — Prism.js applies syntax highlighting for the selected language
  2. Select text — Highlight any span of code to anchor an annotation
  3. Write annotations — Rich text cards with customizable colors and arrows
  4. Arrange — Drag and resize everything on the canvas until it looks right
  5. Export — One-click PNG download at the resolution you need

Example Output

Example annotated code output


Design Decisions


Links

Code Annotator — Annotated Code Snippet Generator screenshot