fix_sandpaper_links: Fix relative and jekyll links to be compatible with sandpaper

View source: R/fix_sandpaper_links.R

fix_sandpaper_linksR Documentation

Description

This function will perform the transformation on three node types:

Usage

fix_sandpaper_links(body, yml = list(), path = NULL, known = NULL)

Arguments

body

an XML document

yml

the list of key/value pairs derived from the ⁠_config.yml⁠ file

path

the path to the current episode

known

a character vector of known episodes in the lesson, relative to the lesson root.

Details

  • image

  • link

  • html_node

The transformation will be to remove relative paths ("../") and replace Jekyll templating (e.g. " page.root " and " site.swc_pages " with either nothing or the link to software carpentry, respectively.

Value

the body, invisibly

Note

This is absolutely NOT comprehensive and some links will fail to be converted. If this happens, please report an issue: https://github.com/carpentries/pegboard/issues/new/

Examples


loop <- fs::path(lesson_fragment(), "_episodes", "14-looping-data-sets.md")
e <- Episode$new(loop)
pegboard:::make_link_table(e)$orig
e$use_sandpaper()
pegboard:::make_link_table(e)$orig

carpentries/pegboard documentation built on Nov. 13, 2024, 8:53 a.m.