
Convert a Jekyll-based lesson to a sandpaper-based lesson
Source:R/use_sandpaper.R
use_sandpaper.RdConvert a Jekyll-based lesson to a sandpaper-based lesson
Usage
use_sandpaper(body, rmd = TRUE, yml = list(), path = NULL, known_paths = NULL)Arguments
- body
the xml body of an episode
- rmd
if
TRUE, the chunks will be converted to RMarkdown chunks- yml
a list derived from the
_config.ymlfile that defines the site variables.- path
the path to the source of the body. Defaults to NULL. This is used in conjunction with
known_paths- known_paths
a character vector with the known paths in the lesson. This is used to determine the correct path to other files in the lesson.
Details
A Jekyll episode is littered with kramdown inline attribute tags and liquid-formatted links. Converting to sandpaper means the following:
links using liquid formatting (e.g.
[text]({{ site.path }}/01-episode/)are replaced with their relative counterparts ([text](01-episode.md).include statements for
links.mdandbase_path.mdare removedimage attributes have the kramdown
:removedcode blocks with a kramdown inline attribute tag are converted to commonmark via the internal
liquid_to_commonmark().Lesson template-specific code is removed from the setup chunk in R Markdown files.