Skip to content

About

Minimal infinite canvas to help you trace an unfamliar codebase. Heavily inspired by Excalidraw.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

manual-code-canvas

An infinite canvas for tracing a foreign codebase by hand. Paste code fragments as you walk down the call chain, draw arrows for control flow, and write concrete variable values over the code like pencil on a printout. The manual work is the point: you build the mental model, not the tool.

No build, no server, no AI. Everything saves as plain, diffable JSON.

Run

Double-click index.html. Works offline in Chrome, Edge, Firefox, Safari.

Everything is static and relative-pathed, so it also runs unmodified from a static host like GitHub Pages — just point Pages at the repo root, no build step. (Some features — real-file auto-save, clipboard paste — need a secure context: https://, http://localhost, or file:// with the caveat below.)

If the file picker is blocked when opened from file://, either use the download/drag-drop flow described under Saving, or serve the folder: python3 -m http.server.

Tools

Tool Key Does
Select S click to select · drag an empty area for a box-select (must fully enclose an object to grab it) · Esc clears
Code C paste (Ctrl/⌘+V) to drop the clipboard in as a new code block, then reverts to Select
Text T click to place, then type
Arrow A click a start point, click an end point
Rectangle R drag to draw, or click for a default size
Image I paste (Ctrl/⌘+V), click to pick a file, or drag an image in; stored inside the JSON

Picking Text, Arrow, or Rectangle (or selecting one of them) opens a small properties pane top-left — stroke color, background (rectangles), stroke width/style, font size (text), and layer order — Excalidraw-style. Like Excalidraw, a property you set there also becomes the default for the next shape of that type, and that default is remembered across reloads until you change it again.

Use

Action How
Original line numbers set the start-line box, or end the title with :87
Mark a line ("I am here") click its line number
Edit a block's code double-click the code text (Settings → "Editable code blocks")
Move drag block header / text box / rectangle / arrow shaft — drags the whole selection if several things are selected
Multi-select box-select, or Shift+click to add/remove one at a time
Duplicate Ctrl/⌘+D (text box, block, arrow, rectangle, or image)
Drop a file image → image · a .canvas.json → opens it · any other text/code file → a code block titled with the filename (all at the drop point)
Copy a text box or rectangle Ctrl/⌘+C, then paste with any tool except Code (places it at the cursor); a text box's text also goes to the system clipboard
Arrow endpoints select the arrow, drag either end to re-aim it (re-pins to whatever block it lands on)
Render / resize a text box select it: M toggles Markdown (top-right of the box), corner handle = font size, right/bottom edges = wrap width / min height
Resize a rectangle select it: 8 handles resize from any edge or corner
Resize an image select it: 4 corner handles, aspect ratio locked
Reorder layers select a text box, arrow, or rectangle → Layers row in the properties pane (send to back / backward / forward / bring to front); code blocks are always the base layer underneath
Find Ctrl/⌘+F — Aa case, ⫖ab⫖ whole word, .* regex — Enter/Shift+Enter or ↑/↓ to jump between matches
Pan space+drag, middle-drag, two-finger scroll
Zoom bottom-left −/+/Fit, Ctrl/⌘+wheel or pinch, + - keys, 0 = fit, click the zoom % to reset to 100%
Delete Delete or Backspace (whole selection)
Undo / redo bottom-left buttons, or Ctrl/⌘+Z, Ctrl/⌘+Shift+Z or Ctrl+Y
Save / Open Ctrl/⌘+S to save, Ctrl/⌘+O to open, or the ☰ menu (New, Open…, Save…, theme, Settings)
Help ? or the bottom-right button

Text boxes, rectangles, and arrow endpoints that overlap a code block are pinned to it and move with it. Anything dropped on empty canvas stays put. Code blocks are deliberately not resizable — their size is their content, so an arrow aimed at an exact line never drifts; if you want something resizable, use a text box or a rectangle.

Text boxes as Markdown

Any text box can render as Markdown (Ctrl/⌘+M, or the M button on its controls). Editing always shows the raw source; a toast offers to render it when pasted text looks like Markdown. While editing, a small toolbar (bold, italic, code, code block, heading, list, quote, link) and Ctrl/⌘+B/I/K apply formatting to the selection. Prose renders in the system font; code stays monospace.

Code blocks

Paste (Code tool) auto-detects the language; the dropdown lets you override it. Editing is live-highlighted, and indent guides are drawn automatically (the indent width is detected per block). Find boxes the exact matched text, not just the containing line.

Saving

  • The working canvas (including camera position) lives in localStorage: reload, crash, or close the tab and it's simply there again. Use New to deliberately start blank.
  • Ctrl/⌘+S never opens a dialog — it silently writes to a linked file if you have one, otherwise just to localStorage (see the status text next to the filename: "Saved to file" vs "Saved").
  • Save… (in the ☰ menu) is what links a file: on Chrome/Edge it opens a picker once, then every change (including plain Ctrl+S) auto-saves to it. The link is remembered across reloads — Chrome may ask to re-grant write permission once, no need to re-pick the file.
  • Firefox/Safari (no File System Access API): Save downloads the JSON; the localStorage copy covers you between saves.

Files

index.html shell · app.js UI · core.js pure logic (tested by tests.html) · style.css · vendor/ highlight.js + marked.js (optional per-note Markdown rendering).

The file format is one JSON object: blocks (code as verbatim strings), notes (text boxes), arrows, rects, images, camera. Safe to commit, diff, and grep. Images are embedded as data: URIs (downscaled and re-encoded to WebP on import), so a saved file stays fully self-contained — no external assets.

About

Minimal infinite canvas to help you trace an unfamliar codebase. Heavily inspired by Excalidraw.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages