learnr_elements.Rd
The following are addon element for learnr tutorials that enable the encoding and decoding of hashed learnr solutions.
Note that when including these functions in a learnr Rmd document it is necessary that
the logic functions, *_logic()
, be included in an R chunk where context="server"
as
they interact with the underlying Shiny functionality. Conversely, any of the ui functions,
*_ui()
, must not be included in an R chunk with a context
. Both types of functions
have been written to provide useful feedback if they detect they are in the wrong R chunk
type.
decoder_logic()
decoder_ui()
encoder_logic(strip_output = FALSE)
default_ui(url = "http://google.com")
iframe_ui(src = "http://google.com", ...)
encoder_ui(ui_before = default_ui(), ui_after = NULL)
Exercises save their output as html, for exercises that result in plots these can result in very large hashes. The option allows this information to be removed to keep hash sizes more manageable.
Link url to use.
Source of the iframe.
Other iframe attributes, e.g. height and width
Shiny ui elements to include before the hash ui
Shiny ui elements to include after the hash ui,
For either of the ui parameters you can wrap multiple
shiny elements together with shiny::div
.