napkin-sketchdocs 1.0.0 GitHub

The command line#

Usage#

napkin-sketch [option] [target]
ParameterDescription
-h, --helpShow help for using the application from the command line.
-v, --versionShow the current version, and where the desktop app is.
-b, --bookOpen a saved sketch book file, using the .skbk extension.
-n, --newNew sketch, using unnamed or the name passed as [target].
-f, --full-screenOpen the GUI window full screen; the default window is maximized.
--no-sandboxLaunch Electron without Chromium's sandbox: for development on a Linux system that blocks it, never a release.
-i, --importImport an SVG, PDF, PNG, JPEG, GIF or WebP into the opening sketch.
-m, --multiple-importsImport a comma-separated list of files, laid out in a grid.
--sharpenAuto-sharpen a saved sketch so it appears more hand-drawn, then open.
--install-guiInstall the desktop app and Electron, about 100 MB, at this version.
--uninstall-guiRemove the desktop app.
--hereWith either of the two above: into, or out of, the current project.
[target]A .skbk file to open, or a name for a new sketch file.

Installed from npm, the command has no window until --install-gui adds the desktop app, a second package with Electron in it; see From npm. The commands below never need it.

The GUI window opens maximized by default, which is not the same as full screen: a maximized window fills the screen while keeping the title bar and its minimize, restore-down, and close buttons in view, and restore-down returns it to its 1280x860 size. Pass -f, --full-screen for true full screen, where those buttons are not in view.

With --multiple-imports, each file's graphic size is measured against the page first, then the graphics fill a row left to right and wrap to a new row whenever the next graphic would overrun the page width; oversized graphics scale down to fit the page. Every imported file becomes its own named layer. Quote file names that contain spaces, for example -m logo.svg,"site map.svg",photo.png.

Commands#

A first word that names a command runs it instead of opening the window. The commands never load Electron, so they work where the GUI cannot start:

napkin-sketch <command> [arguments]
CommandDescription
draw <script | ->Draw a napkin script to svg, png, pdf, skbk or jsx files (--to).
check <script | ->Read and run a script and report what is wrong; write nothing.
render <book.skbk>Write a book as files (--to), or its figure as frames (--animate).
verbsList napkin script's verbs by category, and the shape library.

- reads the script from standard input, and --json prints one line of JSON instead of the human report. The exit code is 0 drew, 1 the arguments were wrong, 2 the script had errors, 3 a file could not be read or written, 4 the AI helper gave back no script. The napkin-sketch command line has every option, and callers in five languages.

Examples#

# Add the desktop app to a command installed from npm (about 100 MB)
napkin-sketch --install-gui

# Open a new, blank sketch
napkin-sketch

# New sketch named "ideas"
napkin-sketch --new ideas

# Open an existing sketch book
napkin-sketch --book ./notes.skbk

# Auto-sharpen a saved book on disk, then open it
napkin-sketch --sharpen ./notes

# Open a new sketch full screen (the default window opens maximized)
napkin-sketch --new -f

# Open a new sketch with logo.svg imported
napkin-sketch --import logo.svg

# Open a new sketch with three files laid out in a grid
napkin-sketch -m logo.svg,"site map.svg",photo.png

# Draw a napkin script to SVG and PNG, with no window
napkin-sketch draw card.napkin --to svg,png --out out

# Check a script handed over on standard input, and report in JSON
napkin-sketch check - --json < card.napkin

A bare path is treated as a sketch book to open:

napkin-sketch ./notes.skbk