Skip to content

Command Line

StellarDeck’s CLI runs the same rendering engine as the desktop app, headless via Playwright. Use it for exports, live preview, validation, batch processing, or agent workflows.

Terminal window
npm install -g stellardeck
npx playwright install chromium # one-time: the headless renderer
stellardeck --help # full reference

Working from a repo checkout instead? Every command below also works as npm run export -- <args>.

Open a deck in the browser for viewing. Starts a temporary server, opens the default browser, and waits. Ctrl+C stops.

Terminal window
stellardeck --preview talk.md

Start a dev server and open the viewer in the browser. Watches for file changes. Ctrl+C stops.

Terminal window
stellardeck --serve
stellardeck --serve --port 8080

Pick one format per invocation. Default is --pdf.

FlagOutputUse case
--pdfSingle PDF fileShare, print, send
--pngDirectory with one PNG per slide (001.png, 002.png…)Thumbnails, social media
--gridSingle composite image of all slidesDeck overview, preview cards
Terminal window
stellardeck talk.md # → talk.pdf (default)
stellardeck --pdf talk.md ~/Desktop/talk.pdf # explicit output path
stellardeck --png talk.md ~/Desktop/slides # → ~/Desktop/slides/001.png...
stellardeck --grid talk.md overview.png # → overview.png
stellardeck --grid --grid-cols 3 talk.md # 3-column grid

Render a deck and collect diagnostics without exporting anything. Returns JSON with slide count and warnings.

Terminal window
stellardeck --validate talk.md

Output:

{
"ok": true,
"slides": 23,
"totalSlides": 23,
"warnings": [
"content overflow on slide 2 (text may be clipped — consider [.autoscale: true])",
"image failed to load: /assets/missing.webp"
]
}

List available themes and their color schemes. No browser needed.

Terminal window
stellardeck --list-themes # JSON array of theme names
stellardeck --list-schemes nordic # JSON array of schemes for "nordic"

Use --slides to export a subset. Accepts ranges, lists, or both:

Terminal window
stellardeck --slides 1-5 talk.md # slides 1 through 5
stellardeck --slides 1,3,5 talk.md # slides 1, 3, and 5
stellardeck --slides 1-3,7,9 talk.md # mixed

Slides are 1-indexed. Out-of-range slides produce warnings but don’t fail the export.

Override deck settings without editing the markdown:

FlagDefaultDescription
--scale <n>2DPI scale factor (1 = 72dpi, 2 = 144dpi, 3 = 216dpi)
--theme <name>deck defaultOverride theme (e.g. nordic, ostrich, fira)
--scheme <n>deck defaultOverride color scheme number
--autoflowoffEnable autoflow layout inference
--port <n>3032Dev server port
Terminal window
stellardeck --theme ostrich --scheme 2 --autoflow --scale 3 talk.md

Export an entire directory tree. Output mirrors the input structure:

Terminal window
stellardeck --input-dir ./decks --output ./dist
decks/intro.md → dist/intro.pdf
decks/talks/keynote.md → dist/talks/keynote.pdf

Works with any format and inherits all rendering options. The browser and dev server are reused across files.

Terminal window
stellardeck --input-dir decks --output dist --grid --grid-cols 3

Pipe markdown by passing - as the input:

Terminal window
echo "# Hello\n---\n# World" | stellardeck --pdf - hello.pdf
cat draft.md | stellardeck --png - ./thumbs

Use --json for machine-readable output (implicit for --validate, --list-themes, --list-schemes):

Terminal window
stellardeck --json --pdf talk.md

Success:

{
"ok": true,
"format": "pdf",
"output": "/path/to/talk.pdf",
"files": null,
"slides": 23,
"totalSlides": 23,
"bytes": 1847293,
"warnings": []
}

Error:

{
"ok": false,
"error": "File not found: nonexistent.md"
}

The files field contains an array of paths for --png mode, null otherwise. Exit code is 1 on error.

Exports succeed even when problems are detected. Warnings surface issues for agents or pipelines to react to:

WarningCause
content overflow on slide NText/elements extend past the 1280x720 frame
image failed to load: <url>Image returned 4xx/5xx or network error
slide N out of range--slides specified a slide past the deck’s end
theme "X" not appliedTheme name not recognized
Terminal window
stellardeck --png --slides 1 --scale 1 talk.md ./thumb
Terminal window
stellardeck --grid --grid-cols 3 --slides 1-9 talk.md card.png
Terminal window
claude "write a 5-slide deck about X in Deckset markdown" \
| stellardeck --pdf --autoflow - out.pdf
Terminal window
result=$(stellardeck --json --pdf slides.md)
if echo "$result" | jq -e '.warnings | any(contains("overflow"))' > /dev/null; then
echo "Overflow detected — re-exporting with autoflow"
stellardeck --json --pdf --autoflow slides.md
fi

The CLI launches headless Chromium via Playwright, loads the same viewer.html the desktop app uses, renders each slide, and captures it. PDF mode composes via pdf-lib; PNG writes individual files; grid composes via sharp. The same code that powers the in-app export button runs here.