`r hide("Title")`
Contents
`r unhide()`Webexercises
webexercises is an R package that allows you to include interactive quizzes in quarto markdown (.qmd) and R markdown (.Rmd) created html pages.
This page includes:
- MCQ examples & template
- Expandable box example/template
- Installation
- Initialisation for your quarto project
There are other widgets that I don’t find use for in the webexercises website.
MCQs
Example
MCQ:
- Question?
Code:
```{r, echo = FALSE}
opts_p <- c("**A1**", "**A2**", answer="**A3**")
```
1. Question? `r longmcq(opts_p)`template
```{r, echo = FALSE}
opts_p <- c("** **", "** **", "** **")
```
`r longmcq(opts_p)`Expandable box
Expandable box:
Contents
Code:
Optionally, you may want to use a callout block.
Contents
::: {.callout-note collapse="true" title="Title"}
Contents
:::Install
See install instruction in the setup page.
Initialise
Open the main directory of your quarto site (directory that contains the index.qmd and _quarto.yml). Run the following command in an R terminal:
library("webexercises")
webexercises::add_to_quarto()This will add the following:
A webex.css and webex.js in an include directory. For a nice MCQ presentation i change the .webex-radiogroup label in webex.css to:
.webex-radiogroup label {
/*Text colour*/
color: : #aaaaaa;
margin-left: 2em;
margin-bottom: 0.25em;
text-indent: -1em;
padding-left: 0.5em;
font-weight: 400;
display: block;
/*Set border of text to solid and dark grey*/
border: 2px solid #808080;
border-radius: 0.25em;
}Additionally, a webexercises.qmd file is created. This contains examples of the various different quizzes. I delete this.