slides v0.3.0
The slides command and its library: Marp’s Markdown parsed and rendered in Go, with Go templates and slide kinds on top. Released as v0.3.0: go install github.com/go-slides/slides/cmd/slides@latest.
slides reads the Markdown Marp reads โ directives, --- between slides, ![bg] backgrounds, speaker notes, the built-in themes โ and adds two things Marp does not have: Go templates inside the deck, and slide kinds, so a slide says what it is instead of repeating how it looks. CGO_ENABLED=0, BSD-3-Clause.
--- marp: true paginate: true footer: {{ .talk }} data: talk: Pure Go slides topics: [Why, How, Next] --- <!-- _kind: title --> # {{ .talk }} {{ range .topics }} --- # {{ . }} {{ end }}
The syntax is Marpit's and Marp Core's, not a dialect of it. A deck written for Marp is read the same way here, and slides expand gives back plain Marp Markdown, so nothing written with the two additions below is locked in.
--- splits slides. Global, local and spot (_class) directives, in the front matter or in HTML comments, with Marp's inheritance from one slide to the next.
![bg], its sizes and filters, split backgrounds, and the image keywords Marp understands.
Header, footer and pagination; speaker notes from comments; fragmented lists; <style scoped> for one slide's CSS.
default, gaia and uncover, selected with theme: as in Marp.
The deck is a text/template, evaluated before the Markdown is parsed โ so a template can generate slides, and a deck can be data plus a layout.
{{ .title }} reads the front matter, and its data: mapping holds whatever else the deck needs.
A {{ range }} that emits --- is a slide generator: one slide per item, per speaker, per release.
{{ page }} and {{ total }} are known only once the deck is split, and are filled in then.
Fenced blocks and inline code are not evaluated by default, so a slide about Go templates can show one. include pulls another file in.
kind: section names a preset of local directives โ header, footer, pagination, class, background. kind: applies to the slide and those after it, _kind: to one slide. Directives written on the slide still win.
title, section, content and blank, each redefinable.
In the front matter's kinds:, or in a kinds YAML file that every deck of a team names.
Switching kinds clears what the previous one set, so a class or a footer does not follow you into the next section.
marp-cli renders images and PDF by driving a headless Chrome. Here the fleet's own Go libraries do it instead. Images and PDF arrived in v0.1.0, PPTX, math and highlighting in v0.2.0, ODP, fitting headings and HCL in v0.3.0; after v0.3.0 the PDF is drawn as vectors, its text selectable โ see the documentation.
One page per deck, the way Marp renders it: each slide an SVG-framed <section> that scales to the window, the theme's CSS, and a keyboard viewer.
The deck with its templates evaluated and its kinds turned into spot directives, written back as plain Marp Markdown โ so any Marp tool can take it from there.
slides notes prints the speaker notes; slides kinds and slides themes list what a deck can name.
A configuration file for a folder of decks: shared kinds, themes, template data, HTML options and language.
--images png|jpeg writes one image per slide (deck.001.png, โฆ), --image the first slide. Rendered by go-webengine, a browser engine in Go โ not a headless Chrome. --image-scale 2 renders at twice the density.
--pdf, or -o deck.pdf: one page per slide at the slide's size, with an outline of slides and headings, written by go-pdfkit. Fonts are embedded; nothing touches the network. After v0.3.0 the pages are vectors: selectable text, sharp shapes, 758 KiB for 100 slides against marp-cli's 837 KiB (--pdf-raster keeps one image per page).
--pptx, or -o deck.pptx: one full-slide picture per slide, with its speaker notes and the deck's metadata, written by go-ooxml. As in marp-cli, the slides are pictures, not editable text; LibreOffice opens it.
$โฆ$ and $$โฆ$$ typeset by go-tex, fenced code highlighted by go-rouge โ in the HTML page, images and PDF.
--odp, or -o deck.odp: an OpenDocument presentation, one picture per slide with its speaker notes.
# <!-- fit --> Title fills the slide width on one line, in the page and in every export.
:smile: shortcodes and Unicode emoji (๐ ๐ฉโ๐ป ๐ซ๐ท) become Twemoji images exactly as Marp Core writes them โ but embedded from go-icons/twemoji instead of loaded from a CDN, so they need no network and draw in the page, images, PDF, PPTX and ODP. Emoji โ
HCL2 wherever a deck takes YAML โ a ---hcl front matter, slides.hcl, kinds and data files โ for expressions and functions: footer = "${upper(data.company)} ยท ${page()}/${total()}". slides expand writes the front matter back as YAML. HCL โ
The slides command and its library: Marp’s Markdown parsed and rendered in Go, with Go templates and slide kinds on top. Released as v0.3.0: go install github.com/go-slides/slides/cmd/slides@latest.
The documentation (Hugo + Hextra), describing v0.3.0: getting started, Marp compatibility, templates, kinds and the command line. Source โ
The mark โ a slide on its stand, in the document family’s indigo โ and every format of it: SVG, PNG, JPG, ICO, ICNS, avatar and social image.
With go-richdoc, go-ooxml, go-tex and go-docutils: documents read, typeset and written in Go, with no C anywhere.
The organisation on GitHub โ