numbats/moodlequiz

Add support for interactive outputs

Open

#31 opened on Jan 18, 2025

 (1 comment) (0 reactions) (0 assignees)R (4 forks)github user discovery
help wanted

Repository metrics

Stars
 (4 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

It appears to be technically possible to import js/css/etc. into a Moodle quiz question.

To accomplish this,

$for(header-includes)$
$header-includes$
$endfor$

will need to be added to the template (bringing in the external dependencies). Then (probably with pandoc lua filters) these dependencies need to be copied over to each question (ideally only to questions with that have that dependency).

A simpler alternative implementation could be changing htmltools:::knit_print.html to directly / inline print the dependencies.

I have tested (somewhat manually)

  • leaflet (tiles appear broken, and parent div doesn't contain them correctly)
  • webr (works well, but text input and submit buttons cause question submission)

A custom dependency resolver could be a useful starting point: https://github.com/rstudio/rmarkdown/blob/204879ff62c00df6b0910c4ed6a1f8e143c551e8/R/html_dependencies.R#L292-L304


More generally, supporting external dependencies (header-includes) will improve the output with CSS features like code highlighting and improved table formatting.

Contributor guide