Skip to contents

Validates the edited presentation.yaml (including, when layout is set, that it names a real entry in the project's layouts.yaml) before writing – see deck_set_config()'s own docstring for the same validate-before-write guarantee.

Usage

deck_add_slide(
  presentation,
  id,
  layout = NULL,
  notes = NULL,
  elements = NULL,
  after = NULL,
  before = NULL,
  index = NULL
)

Arguments

presentation

Path to presentation.yaml.

id

The new slide's unique id.

layout

The layout name to use, or NULL (default) for a freeform slide (layout: null).

notes

Speaker notes text, or NULL (default) for none.

elements

A (typically named, keyed by element id) list to use as the slide's elements block, or NULL (default) to add none yet. Encoded as JSON en route to the CLI, so nested boxes/styles are written exactly as given – a named list becomes a JSON object (matching a layout-driven slide's elements: {title: ..., ...} form), an unnamed list becomes a JSON array (matching a freeform slide's elements: [{id: ..., ...}, ...] form).

after, before, index

At most one of these controls placement: immediately after/before an existing slide id, or at a 0-based index. Default (all NULL) appends the slide at the end.

Value

The CLI result (invisibly).

Examples

if (FALSE) { # \dontrun{
# Copy the bundled example into a scratch directory first -- slide
# commands write to `presentation` in place.
project_dir <- file.path(tempdir(), "my-deck")
dir.create(project_dir)
file.copy(
  list.files(
    system.file("examples", "minimal-deck", package = "deckifyr"),
    full.names = TRUE
  ),
  project_dir
)
presentation <- file.path(project_dir, "presentation.yaml")
deck_add_slide(presentation, id = "new-slide", layout = "blank")
} # }