Skip to content

Command line

Every command and flag of slides, and the slides.yaml configuration file.

This page describes v0.3.0.
slides [deck.md] [flags]
slides [command] [flags] deck.md

Commands

CommandWhat it does
buildwrites the presentation as HTML, or as a PDF or images (see below). The default: slides deck.md is slides build deck.md
expandprints the deck as plain Marp Markdown: templates expanded, kinds replaced by the directives they stand for
notesprints the speaker notes
kindslists the kinds the deck can use and what they set
themeslists the themes
versionprints the version (so does slides --version)
completionprints a shell completion script: bash, zsh, fish or powershell

slides <command> --help prints the flags of a command. Flags may come before or after the deck: slides deck.md -o out.html and slides -o out.html deck.md are the same. Long flags take two dashes (--html); -o is the only short one. build writes deck.html beside deck.md unless -o says otherwise.

Flags

FlagCommandsWhat it does
-o, --output filebuild, expand, notesoutput file; - for standard output
--config fileallconfiguration file; by default slides.yaml next to the deck, if there is one
--no-configalldo not read a configuration file
--theme-set pathalla theme CSS file, or a directory of them (repeatable)
--kinds filealla YAML file of kinds (repeatable)
--data filealla YAML or JSON file of template data (repeatable)
--set key=valueallone template value (repeatable)
--no-templatealldo not expand Go templates
--strict-yamlallparse directives as strict YAML, as plain Marpit does (Marp Core parses them loosely)
--no-emojiallleave :shortcodes: and Unicode emoji as text instead of drawing them as images (after v0.3.0: Emoji)
--htmlbuildallow all raw HTML; by default, Marp Core’s allowlist
--lang codebuildthe page’s lang when the deck sets none
--barebuildstack the slides, without the presenting script
--pdfbuildwrite a PDF, one page per slide, with an outline (also chosen by -o file.pdf)
--images png|jpegbuildwrite one image per slide: deck.001.png, …
--image png|jpegbuildwrite the first slide as an image (also chosen by -o file.png or -o file.jpg)
--pptxbuildwrite a PowerPoint file, one full-slide picture per slide with its speaker notes (also chosen by -o file.pptx); --image-scale defaults to 2
--odpbuildwrite an OpenDocument presentation, one full-slide picture per slide with its speaker notes (also chosen by -o file.odp)
--jpeg-quality nbuildJPEG quality, 1 to 100 (default 85)
--image-scale nbuilddevice pixels per CSS pixel for images and PDF (default 1); 2 gives 2560×1440 for 16:9, with text and vectors drawn at that density, not enlarged
--allow-local-filesbuildlet images and PDF read local files, from under the deck’s directory only; refused by default, as with marp-cli

Images, PDF, PPTX and ODP

-o with a .pdf, .pptx, .odp, .png or .jpg extension picks the format, as marp-cli does. Output directories are created. A PDF has one page per slide, at the slide’s size, and an outline of the slides and their headings.

Rendering is done by go-webengine and the PDF is written by go-pdfkit; the fonts the built-in themes ask for (Lato, Roboto Mono) come from go-opentype/fonts and are embedded, so no render touches the network. There is no Chrome.

--image-scale 2 renders at two device pixels per CSS pixel. Local images are refused unless --allow-local-files is given, and even then only files under the deck’s directory are read: a deck from elsewhere cannot reach ~/.ssh. Several and split backgrounds (![bg left:40%]) render as Marp’s layers do.

--pptx writes the deck with go-ooxml’s WritePresentation: each slide is one full-slide picture, with its speaker notes and the deck’s metadata. As in marp-cli, the slides are pictures, not editable text. The scale defaults to 2 and --image-scale overrides it; LibreOffice opens the result.

--odp writes the same thing as an OpenDocument presentation, through go-odf’s WritePresentation: one picture per slide, with its speaker notes.

Known limit: a PDF holds one image per slide, so it is larger than a vector PDF (about 10 MiB against 0.8 MiB for 100 slides, in the v0.3.0 notes).

slides.yaml

A configuration file next to the deck applies to it, so a folder of decks shares one:

kinds: kinds.yaml        # a mapping of kinds, or file(s) holding one
themes:                  # theme CSS files or directories
  - themes/
data:                    # template data
  company: Example Inc.
html: false              # allow all raw HTML
lang: en

Kinds: the deck’s own kinds: override the file’s and the command line’s. Data: the file’s and the command line’s data override the deck’s front matter, so one deck can be built with different data.

Planned

Not built yet: a vector PDF (a PDF holds images today). When it arrives, it is a command or flag here.

Created on by tannevaled

Modified on by tannevaled