loading...

Insert H5P content in the document

h5p(
  id,
  baseurl,
  width = 780,
  height = 500,
  toc = "",
  toc.def = "H5P exercise {id}",
  h5p.img = "images/list-h5p.png",
  h5p.link = "h5p"
)

Arguments

id

The ID of the H5P content in your Wordpress.

baseurl

The first part of the URL for your domain, usually something like https://my.site.com without the trailing /.

width

The width of the iframe where the H5P content is displayed.

height

The height of the iframe.

toc

Entry to use in the exercises table of content (NULL if no entry, "" for a default entry based on toc.def =).

toc.def

Text for a default toc entry using glue() syntax for replacement, e.g., {var}.

h5p.img

The image to display in front of the toc entry

h5p.link

The link when the image is clicked (sends to an help page about learnr tutorials).

Value

HTML code that generates the iframe. It is most conveniently used inside and R inline expression in your R Markdown document on its own line with one blank line above and bellow it.

Details

This function is designed to work inside a Wordpress site where the H5P plugin has been installed. You should also serve your bookdown pages as a subdirectory inside of the same Wordpress site to allow free communication between the parent (the bookdown page) and the child document in the iframe (the H5P content).