Skip to contents

value is parsed as JSON by default – "true"/"12"/"[1, 2]" become their native typed values – so a plain word, hex color, or font name ("Arial", "#2457A6") needs no quoting and is written as a literal string. Use as_string = TRUE for the rare case a value would otherwise parse as something other than a string (writing the literal text "true" or "null", for instance). The edited document is validated against its schema – and, for presentation.yaml, any changed slide.layout is cross-checked against the project's layouts.yaml – before anything is written to file, so a bad edit never corrupts it.

Usage

deck_set_config(
  file,
  path,
  value,
  as_string = FALSE,
  type = c("auto", "design", "layouts", "presentation")
)

Arguments

file

Path to a design.yaml, layouts.yaml, or presentation.yaml.

path

Dotted path to write, same syntax as deck_get_config().

value

The value to write.

as_string

Treat value as a literal string rather than parsing it as JSON. Default FALSE.

type

Which schema to validate the edited document against. "auto" (the default) detects it from the document's own top-level keys.

Value

The parsed CLI result (invisibly).

Examples

if (FALSE) { # \dontrun{
# Copy the bundled example into a scratch directory first -- deck_set_config()
# writes to `file` in place.
project_dir <- file.path(tempdir(), "my-deck")
dir.create(project_dir)
file.copy(
  system.file("examples", "minimal-deck", "design.yaml", package = "deckifyr"),
  file.path(project_dir, "design.yaml")
)
deck_set_config(file.path(project_dir, "design.yaml"), "colors.primary", "#2457A6")
} # }