Documentation
¶
Overview ¶
Package viewer writes a deck as one self-contained HTML page: the slides, their style sheet, and a small script to present them — keyboard and pointer navigation, fragmented lists, a slide per URL hash, and printing every slide on its own page. It plays the part of marp-cli's templates.
Index ¶
Constants ¶
const SyncParent = "parent"
SyncParent is the Bespoke.Sync that goes through the parent window.
The messages are plain objects posted to window.parent (with target "*": a sandboxed page has an opaque origin, and the content is two numbers): {slidesSync: {index, fragmentIndex}} each way, after every change of slide or step, and {slidesPresent: true} from the page to open the presenter view. A page takes a slidesSync only from its parent.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bespoke ¶ added in v0.6.0
type Bespoke struct {
// OSC is the on-screen controller (--bespoke.osc).
OSC bool
// Progress is the progress bar (--bespoke.progress).
Progress bool
// Transition plays the transitions of the deck with the View Transition
// API where the browser has it (--bespoke.transition). Set it only for a
// deck that has some: the page carries the script for it.
Transition bool
// Presenter is the presenter view (the p key, ?view=presenter): the
// current slide, the next step, the notes, a timer, synchronised with the
// page through localStorage. marp-cli's bespoke template always has it.
Presenter bool
// View is the view the page shows when its URL names none (?view=):
// "" the slides, "presenter" the presenter view. A page with no URL of
// its own (an iframe's srcdoc) can only be told this way.
View string
// Sync is how the windows of a talk follow one another: "" through
// localStorage, as marp-cli does; SyncParent through messages to the
// parent window, for a page in a sandboxed iframe, which has no storage.
// The parent relays them between the audience's page and the presenter's,
// and opens the presenter view when the page asks (the p key, the
// controller's button). The presenter view then draws the next step
// itself instead of embedding the page a second time.
Sync string
}
Bespoke are marp-cli's --bespoke.* options.
func DefaultBespoke ¶ added in v0.6.0
func DefaultBespoke() Bespoke
DefaultBespoke are marp-cli's defaults: the controller, no progress bar, transitions, and the presenter view.
type Meta ¶
type Meta struct {
Title, Description, Author, Keywords, URL, Image, Lang string
}
Meta is the page's metadata (marp-cli's title, description, author, keywords, url and image global directives).
type Options ¶
type Options struct {
Meta Meta
// CSS is the packed theme style sheet.
CSS string
// Slides are the rendered slides, frames included.
Slides []string
// Bare leaves the script out: the slides stack vertically, as in
// marp-cli's bare template.
Bare bool
// WatchWS, when not empty, is the address of the live reload socket the
// page opens (see serve.Hub): a ws:// URL, or a path on the page's host.
WatchWS string
// Bespoke are the options of the presenting page (marp-cli's bespoke
// template); the zero value is a page with none of them.
Bespoke Bespoke
// TransitionCSS is the keyframes of the built-in transitions the deck
// uses, written after the transition styles (see deck.TransitionCSS).
TransitionCSS string
// Notes are the speaker notes of each slide, one entry for each comment;
// they are written, escaped, for the presenter view when Bespoke.Presenter
// is set. A slide without notes has none.
Notes [][]string
}
Options configures Document.