learnr 0.10.0
learnr
0.10.0 has been released! In this version of learnr
, quiz questions have been expanded to allow for more question types. Text box quiz questions have been implemented natively within learnr
and ranking questions have been implemented using the sortable
package.
The learnr
R package makes it easy to turn any R Markdown document into an interactive tutorial. Tutorials consist of content along with interactive components for checking and reinforcing understanding. Tutorials can include any or all of the following:
Narrative, figures, illustrations, and equations.
Code exercises (R code chunks that users can edit and execute directly).
Quiz questions.
Videos (supported services include YouTube and Vimeo).
Interactive Shiny components.
Tutorials automatically preserve work done within them, so if a user works on a few exercises or questions and returns to the tutorial later they can pick up right where they left off.
Test out the latest interactive demo of sortable
's ranking quiz question.
learnr::run_tutorial("question_rank", "sortable")
I am excited to announce that quiz questions are now mini shiny applications. This opens the door to new and extendable question types, such as text box and ranking questions. The sortable
R package (an htmlwidgets
wrapper around the drag-and-drop Sortable.js
) has already implemented ranking questions using the new learnr
quiz question API. Thank you Kenton Russell for originally pursuing sortable
and Andrie de Vries for connecting the two packages.
Please see learnr::run_tutorial("quiz_question", "learnr")
for more information.
A new function, available_tutorials()
, has been added. When called, this function will find all available tutorials in every installed R package. If a package
name is provided, only that package will be searched. This functionality has been integrated into run_tutorial
if a user provides a wrong tutorial name or forgets the package name.
Please see ?learnr::available_tutorials
for more information.
Using the latest rmarkdown
, learnr
tutorials are now agressively pre-rendered. For package developers, please do not include the pre-rendered HTML files in your package as users will most likely need to recompile the tutorial. See learnr
's .Rbuildignore
for an example.
If your learnr
tutorial contains broken code within exercises for users to fix, the CRAN version of packrat
will not find all of your dependencies to install when the tutorial is deployed. To deploy tutorials containing exercise code with syntax errors, install the development version of packrat
. This version of packrat
is able to find dependencies per R chunk, allowing for broken R chunks within the tutorial file.
remotes::install_github("rstudio/packrat")
learnr
0.10.0 includes some non-backward-compatible bug fixes involving a the browser’s local storage. It is possible that the browser’s local storage will have a “cache miss” and existing users will be treated like new users.
learnr
change logQuiz questions are implemented using shiny modules (instead of htmlwidgets). (#194)
Aggressively rerender prerendered tutorials in favor of a cohesive exercise environment (#169, #179, and rstudio/rmarkdown#1420)
Added a new function, safe
, which evaluates code in a new, safe R environment. (#174)
Added the last evaluated exercise submission value, last_value
, as an exercise checker function argument. (#228)
Question width will expand to the container width. (#222)
Available tutorial names will be displayed when no name
parameter or an incorrect name
is provided to run_tutorial()
. (#234)
The options
parameter was added to question
to allow custom questions to pass along custom information. See sortable::sortable_question
for an example. (#243)
Missing package dependencies will ask to be installed at tutorial run time. (@isteves
, #253)
When questions are tried again, the existing answer will remain, not forcing the user to restart from scratch. (#270)
A version number has been added to question_submission
events. This will help when using custom storage methods. (#291)
Tutorial storage on the browser is now executed directly on indexedDB
using idb-keyval
(dropping localforage
). This change prevents browser tabs from blocking each other when trying to access indexedDB
data. (#305)
Fixed a spurious console warning when running exercises using Pandoc 2.0. (#154)
Added a fail-safe to try-catch bad student code that would crash the tutorial. (@adamblake
, #229)
Replaced references to checkthat
and grader
in docs with gradethis (#269)
Removed a warning created by pandoc when evaluating exercises where pandoc was wanting a title or pagetitle. #303