Fork me on GitHub

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. CGO_ENABLED=0, BSD-3-Clause.

v0.3.0 โ€” releasedHTML, expand, PNG/JPEG, PDF, PPTX, ODP, math, code and HCL 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, 3 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.

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; after v0.3.0 the PDF is drawn as vectors, its text selectable โ€” 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. 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 v0.2.0

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

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, one picture per slide with its speaker notes.

Fitting headings v0.3.0

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

Emoji on main

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

The organisation

Repositories

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.

docs v0.3

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

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.

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