Skip to content

Returns information about the current tutorial. Ideally the function should be evaluated in a Shiny context, i.e. in a chunk with option context = "server". Note that the values of this function may change after the tutorial is completely initialized. If called in a non-reactive context, get_tutorial_info() will return default values that will most likely correspond to the current tutorial.

Usage

get_tutorial_info(
  session = getDefaultReactiveDomain(),
  tutorial_path = NULL,
  ...
)

Arguments

session

The session object passed to function given to shinyServer. Default is shiny::getDefaultReactiveDomain().

tutorial_path

Path to a tutorial .Rmd source file

...

Arguments passed on to rmarkdown::yaml_front_matter

input

Input file (Rmd or plain markdown)

encoding

Ignored. The encoding is always assumed to be UTF-8.

Value

Returns an ordinary list with the following elements:

  • tutorial_id: The ID of the tutorial, auto-generated or from the tutorial$id key in the tutorial's YAML front matter.

  • tutorial_version: The tutorial's version, auto-generated or from the tutorial$version key in the tutorial's YAML front matter.

  • items: A data frame with columns order, label, type and data describing the items (questions and exercises) in the tutorial. This item is only available in the running tutorial, not during the static pre-render step.

  • user_id: The current user.

  • learnr_version: The current version of the running learnr package.

  • language: The current language of the tutorial, either as chosen by the user or as specified in the language item of the YAML front matter.