excalidraw-cli
Experimental Excalidraw CLI tool.
Parses Excalidraw JSON schemas (*.excalidraw
) into PNGs (*.excalidraw.png
).
This project is a follow-up to excalidraw#1261 and strives to provide a CLI for excalidraw.
Demo
Install
npm install -g @tommywalkie/excalidraw-cli
Usage
$ excalidraw-cli --help
Parses Excalidraw JSON schemas into PNGs
USAGE
$ excalidraw-cli [INPUT] [OUTPUT]
ARGUMENTS
INPUT [default: {cwd}] Excalidraw file path / directory path
OUTPUT [default: {cwd}] Output PNG file path / directory path
OPTIONS
-h, --help show CLI help
-q, --quiet disable console outputs
-v, --version show CLI version
How it works ?
excalidraw-cli
uses node-canvas at its core, this allows to generate canvas without relying on the window
context, and uses a home-made renderer which tries to mimic Excalidraw's as much as possible, using Rough.js API primarily.
Hopefully, excalidraw-cli
will directly use Excalidraw renderer methods (like drawElementOnCanvas()
) for consistent results, when they will be exported.
See the related issue thread excalidraw#1780.
Caveats
The currently used home-made renderer now supports any Excalidraw shape element but it's not perfect, there are still a few known issues :
- Rotated objects can sometimes exceed canvas dimensions if too close of one side
- Font ligatures are not supported yet
License
MIT