Fork me on GitHub
Digital Commons

Slide decks in Markdown,
rendered in pure Go.

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.

v0.31.1 โ€” releasedHTML, expand, PNG/JPEG, vector and accessible PDF, editable PPTX and ODP, vector math and emoji, code with line numbers and callouts, HCL, watch, serve, a presenter and an overview view todayno headless Chrome
talk.md
---
marp: true
paginate: true
footer: {{ .talk }}
data:
  talk: Pure Go slides
  topics: [Why, How, Next]
---

<!-- _kind: title -->
# {{ .talk }}

{{ range .topics }}
---

# {{ . }}
{{ end }}
One organisation, 5 repositories
Compatibility

A Marp deck is a go-slides deck.

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.

โž—

Slides and directives

--- 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.

๐Ÿ–ผ๏ธ

Images and backgrounds

![bg], its sizes and filters, split backgrounds, and the image keywords Marp understands.

๐Ÿ—’๏ธ

Around the slide

Header, footer and pagination; speaker notes from comments; fragmented lists; <style scoped> for one slide's CSS.

๐ŸŽจ

The built-in themes

default, gaia and uncover, selected with theme: as in Marp.

The first addition

Go templates, inside the deck.

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.

๐Ÿ”ค

Values

{{ .title }} reads the front matter, and its data: mapping holds whatever else the deck needs.

๐Ÿ”

Slides from data

A {{ range }} that emits --- is a slide generator: one slide per item, per speaker, per release.

#๏ธโƒฃ

Page and total

{{ page }} and {{ total }} are known only once the deck is split, and are filled in then.

๐Ÿงพ

Code is left alone

Fenced blocks and inline code are not evaluated by default, so a slide about Go templates can show one. include pulls another file in.

The second addition

A slide says what it is.

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.

๐Ÿท๏ธ

Built in

title, section, content and blank, each redefinable.

๐Ÿ“

Defined once, shared

In the front matter's kinds:, or in a kinds YAML file that every deck of a team names.

๐Ÿงน

Nothing leaks

Switching kinds clears what the previous one set, so a class or a footer does not follow you into the next section.

Try it

A deck in your browser.

The playground is go-slides itself, compiled to WebAssembly: write on the left, the slides follow on the right. Nothing is installed and nothing is sent to a server. The playground's own interface follows the page's language.

โšก

Live

The slides render in a worker as you type, the preview scrolls with the editor, a minimap and a column of slide thumbnails follow it, and the slideshow presents with its transitions. Present opens the presenter view, with your notes and a timer, in a second window.

๐Ÿ’ก

Help built in

Completion and explanations for directives, kinds and template functions; problems marked on their line; example decks, math, images and backgrounds among them (drop an image file into the editor); links to the documentation. A file panel holds the project: your themes, kinds and data files, and the media you drop, in the layout the slides command builds. A Format tab writes the Markdown for you, with Undo: bold, italic, underline, lists, a table from a grid, the slide's text alignment and links. Every pane resizes.

๐Ÿ”—

Share, save, keep

A link carries the deck itself, compressed in its #. Save it as HTML, a vector PDF, or an editable PowerPoint or OpenDocument deck, all made in your browser, or download the whole project as a .zip. Your draft survives a reload, in your browser only.

What it does

HTML first. The rest without a browser to drive.

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, the vector PDF (its text selectable) and emoji in v0.4.0; in v0.5.0 the PPTX and ODP became editable, where marp-cli's PPTX is pictures; v0.6.0 adds watch, serve, transitions and marp-cli's options, v0.7.0 the presenter view โ€” see the documentation.

HTML v0.1.0

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.

slides expand v0.1.0

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.

notes, kinds, themes v0.1.0

slides notes prints the speaker notes; slides kinds and slides themes list what a deck can name.

slides.yaml v0.1.0

A configuration file for a folder of decks: shared kinds, themes, template data, HTML options and language.

PNG / JPEG v0.1.0

--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 v0.1.0

--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. Since v0.4.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 v0.2.0

--pptx, or -o deck.pptx: with its speaker notes and the deck's metadata, written by go-ooxml. Since v0.5.0 the slides are editable โ€” text boxes in the deck's own fonts (embedded), shapes, gradients, pictures stored once โ€” where marp-cli's are pictures (--pptx-raster keeps them). 100 slides: 692 ms on one core and 276 ms on 16, against marp-cli's 7.2 s (v0.26.1); 760 KiB, against marp-cli's 7.2 MiB.

Math and highlighting v0.2.0

$โ€ฆ$ and $$โ€ฆ$$ typeset by go-tex, fenced code highlighted by go-rouge โ€” in the HTML page, images and PDF.

ODP v0.3.0

--odp, or -o deck.odp: an OpenDocument presentation with its speaker notes โ€” editable since v0.5.0, like the PPTX (--odp-raster for one picture per slide).

Fitting headings v0.3.0

# <!-- fit --> Title fills the slide width on one line, in the page and in every export.

Emoji v0.4.0

: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 โ†’

HCL v0.3.0

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 โ†’

Watch, serve, preview v0.6.0

--watch builds again what changes and reloads the open pages; --server dir serves a folder of decks โ€” deck.md as a page, deck.md?pdf, ?pptx, ?png, ?notes converted on request โ€” on 127.0.0.1, checking the Host and Origin, never leaving the folder; --preview opens the browser. marp-cli's routes and live reload, without its open port. Command line โ†’

Many decks v0.6.0

slides -I decks/ -o site/ converts every deck under a folder and mirrors the tree; several files, a folder or a pattern at once, -P at a time.

Transitions v0.6.0

marp-cli's <!-- transition: fade 1s -->, with its 33 built-in transitions, played with the browser's View Transition API; an on-screen controller; --template bare. The PDF, PPTX and ODP exports carry them too, on the next slide, and fragmented lists become click builds in the PPTX and ODP (--pdf-fragments writes one PDF page per step). Since v0.18.0; checked in LibreOffice only, not verified in PowerPoint.

Notes in PDF, metadata, marp-cli's options v0.6.0

--notes writes the speaker notes as text, --pdf-notes puts them on the PDF pages, --pdf-outlines its bookmarks; --title, --author, --keywords, --url, --og-image, --theme; marp-cli's .marprc and --config-file (JSON, YAML) are read.

Overview view v0.8.0

Press o: every slide in a grid, the arrows choose one, Enter or a click goes to it โ€” over the page or over the presenter view, in marp-cli's URLs and with its sync, no network. Slides are labelled and focusable; the closed overview is inert. Command line โ†’

Presenter view v0.7.0

Press p on the page: the current slide, the next step, your speaker notes (escaped, never in what the audience's screen reader reads), a clock and a timer, in a second window that follows the first and the first follows it โ€” marp-cli's URLs and sync, through localStorage, no server and no network. About 10 KB a page. Command line โ†’

Line numbers and code callouts v0.8.0

```go {lineNumbers} numbers the lines of a code block ({lineNumbers=10} starts at 10); a marker in a comment at the end of a line (// <1>) followed by a numbered list gives a numbered disc on the line and on its note โ€” in the page, images, PDF, PPTX and ODP. The numbers and discs are not copied with the code. Math and code โ†’

Theme packages v0.18.0

A theme in one .gsta.xz file: a tar archive compressed with xz, with a theme.hcl that names it and lists its CSS, fonts, assets and kinds. slides theme pack|verify|install|list|remove manage packages, and --theme accepts one. Archives are untrusted input: links, unsafe paths, bombs and bad checksums are refused with coded errors. Theme packages โ†’

Terminal recordings v0.18.0

![cast](demo.cast) embeds an asciinema recording: it plays in a built-in player in the HTML page, with no third-party script and paused under reduced motion; in the PDF, PPTX and ODP the screen at a chosen time (#t=12.5) is drawn as vector text. Terminal recordings โ†’

Animations in the exports v0.18.0

Marp transitions become slide transitions in the PPTX and ODP, and fragmented lists become click-by-click fades; each PDF page gets a /Trans transition, and --pdf-fragments writes one page per fragment step. Command line โ†’

Video v0.19.0

![video](clip.mp4#t=12.5) embeds a video: the browser plays it in the HTML page, never with sound by itself and paused under reduced motion; the PDF shows the poster frame at a chosen time with a link to the file, and the PPTX and ODP embed the video. Video โ†’

Animated SVG v0.20.0

An SVG image that animates itself plays in the HTML page. In the PPTX and ODP each animated element is a shape with its own animation (movement, rotation, scale, opacity, colour) that starts with the slide, or an animated GIF where those cannot say it; the PDF and images show the initial state. A local image blocked without --allow-local-files is now said, not dropped. Animated SVG โ†’

Math font and emoji behind providers v0.23.0

The math font (v0.22.0) and the emoji pictures (v0.23.0) come through providers: mathfont.Provider and emoji.Provider. The command still embeds both and its output is byte-identical. A host that does not want them builds with slides_nomathfont or slides_noemoji and links none of the data (a js/wasm build is 651 KB and 2.06 MB gzipped smaller), supplying them later: until then a formula shows as its TeX source and an emoji as its text. A provider's picture is at most 256 KiB, embedded as a data: image.

Slides refresh when the font or pictures arrive v0.24.0

A host that registers the math font or the emoji pictures after the first render no longer keeps the fallback text: the render cache re-renders only the slides that fell back, once a provider is registered, and slides with no formula and no emoji stay cached. The command's output is unchanged.

A provider's font is bounded before it is parsed v0.25.0

A math font supplied by a provider is rebuilt from the tables the typesetter reads, and refused after a few KB when its declared counts would make the parser allocate too much (a 924-byte font that allocated 1.36 GB). The math font is untrusted input since v0.27.0, and bounded: every glyph (CFF and CFF2 included), then the total, at most 128 MiB of TrueType outlines or 64 MiB of CFF path text (the shipped STIX Two Math is one), or 1,350,000 charstring operators in all (STIX Two Math is 166,885), checked by one pass at load that counts operators, not time (since v0.28.0). The embedded font renders byte-identically.

One scheduler, and a multi-core table v0.26.0

Export's worker pool and the -P pool for several decks both run on the fleet's shared inflight.Ordered: bounded, in order, stopping at the first error, with byte-identical files. With -P, a deck's messages and the list of failed decks now come out in command-line order, not finish order. The release adds a multi-core table against marp-cli (slidesbench -cores); 20-slide decks and 100 slides to PNG are faster than marp-cli at every core count. The 100-slide PDF was not: 3166 ms on one core and 2568 ms on 16, against marp-cli's 1513 ms, and the 100-slide PDF and PPTX did not scale with cores (tracked in #117; fixed in v0.26.1).

Shared font instances v0.26.1

go-webengine/engine v0.48.0 shares a variable font's static instances across pages instead of rebuilding them for every page (engine#443), which fixes the regression of v0.18.0 to v0.26.0 tracked in #117. The 100-slide PDF takes 544 ms on one core (3166 ms before) and 256 ms on 16, and peaks at 169 MiB instead of 2182 MiB; the 100-slide PPTX takes 692 ms on one core (3299 ms before) and 276 ms on 16. The PDF is 792.4 KiB instead of 1005.5 KiB, because the font is embedded 3 times instead of 102; the pages are pixel-identical. go-slides is now faster than marp-cli on every deck, mode and core count measured.

Smaller PDF and PPTX v0.31.1

Opaque photos go into the PDF as JPEG instead of raw pixels, and into PPTX and ODP as JPEG at their drawn size: on a real 6-slide deck the PDF is 10.0 MB โ†’ 1.7 MB and the PPTX 24.0 MB โ†’ 3.9 MB. Command line โ†’

One-file HTML, JPEG PDF pages v0.31.0

--embed-assets makes the HTML page one file: local images and CSS url() become data: URLs (2.76 MB for a 6-slide deck). --pdf-raster-format jpeg makes the raster PDF's pages 4 times smaller (4.0 MB โ†’ 1.0 MB); --set git.tag=โ€ฆ overrides the git function. Command line โ†’

The deck's version v0.30.0

footer: '{{ git "describe" }}' prints the tag and commit a deck was built from, plus -dirty. The git binary is never run: the repository is read in Go, under 7 bounds. Templates โ†’

The organisation

Repositories

slides v0.31.1

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.31.1: go install github.com/go-slides/slides/cmd/slides@latest.

docs v0.31

The documentation (Hugo + Hextra), describing v0.31.1: getting started, Marp compatibility, templates, kinds and the command line. Source โ†’

vscode v0.5.0

The VS Code extension, as Marp for VS Code is Marp’s: decks previewed in VS Code’s Markdown preview by go-slides compiled to WebAssembly (no binary, works on vscode.dev), scrolling in sync with the editor through templates, errors in the Problems panel, completion of directives, kinds and template functions, an overview and a presenter view beside the editor, export through slides, with an accessible, tagged PDF. Install the .vsix attached to the GitHub release; publication on the Marketplace and Open VSX is prepared, but it is not there yet. VS Code โ†’

brand ready

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.

gitd v0.1.1

slides-gitd, the self-hosted git backend for the go-slides playground: the forge’s credentials stay on the server, each user is isolated, and it runs behind oauth2-proxy. Pure Go.

Part of the document family.

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 โ†’