The koma command
On this page
One command for .koma files: it finds problems, tidies a file into the standard form, exports it to HTML, PDF, PowerPoint or pictures, and prints the syntax tree for programs. How to install it is on Start.
Check and tidy
# find problems and untidy text; changes nothing
koma check talk.koma
# apply the safe fixes, then tidy
koma check --write talk.koma
# only the problems
koma lint talk.koma
# only tidy into the standard form
koma format --write talk.koma
Without --write nothing is rewritten. A command exits with 1 when it finds something worse than a note. Every problem it can report is listed in the diagnostics of the specification; the standard form is in Conformance.
Export and pack
# draw the document: the ending of -o picks HTML, PDF or PowerPoint
koma export talk.koma -o talk.pdf
# a PNG per page into a folder; --pages picks some
koma export talk.koma --to png -o pages --pages 1,3-4
# the document, its pictures and its theme in one .komadoc, without drawing
koma pack talk.koma -o talk.komadoc
# also render a first-page cover thumbnail at Content.textbundle/preview.png
koma pack --cover talk.koma -o talk.komadoc
export draws with Google Chrome, Chromium or Microsoft Edge already on your computer; it never downloads one. Name it with --browser <path> if it is not found. Nothing is written over without --force, the input is never changed, and nothing is fetched from the network. koma carries its default theme; a document on another theme exports from a .komadoc, which always carries the theme it was made with.
koma pack needs no browser and keeps an existing valid cover when repacking a .komadoc. Pass --cover to draw the first page into the optional Content.textbundle/preview.png cover (at most 640 × 1280 px and 256 KiB; see the .komadoc reference); if no browser is available, it still writes the package without a new cover and reports so on stderr.
Start, import and theme
# a new document with a cover and a content page
koma new talk.koma --size 16:9
# Markdown into Koma source; the flavour is read from the file unless --from names it
koma import notes.md -o notes.koma
# an editable copy of a built-in theme, then the document's theme pinned beside it
koma theme copy talk -o themes/my-talk
koma theme freeze talk.koma
For AI agents
# a local, read-only MCP server over the files you name
koma mcp talk.koma
For editors
# a Language Server over standard input and output
koma lsp
In Visual Studio Code, the Koma extension adds syntax highlighting (including quiet speaker cues), diagnostics, canonical formatting, and a live side-by-side preview. Other editors that speak the Language Server Protocol, such as Zed, Neovim, Helix and Cursor, start koma lsp for .koma files. It shows the problems koma lint finds, tidies into the standard form as koma format does, and offers the outline, completion of element names and settings, and hover. It reads only what the editor sends and the theme and style sheets beside the file, and writes nothing.
For programs
The commands take --json. koma parse prints the syntax tree — readable by default, as JSON with --json — and the same package can be used as a library:
import { parse, lint, format } from '@komalang/koma'
The tree follows unist, as mdast does, so unist tools can walk it. Its node kinds, fields and positions are part of the language’s conformance, and are listed in the reference. --json names the version of the tree’s shape as astVersion, and the types come with the package.
JSON Schemas describe what programs read and write, so editors can complete and check it: koma parse --json (AST version 1), a theme’s theme.json and a .komadoc package’s info.json. The package carries the same files in @komalang/koma/schemas/.