liquid_to_commonmark: Convert liquid code blocks to commonmark code blocks

View source: R/liquid_to_commonmark.R

liquid_to_commonmarkR Documentation

Convert liquid code blocks to commonmark code blocks

Description

Liquid code blocks are generally codified by

Usage

liquid_to_commonmark(block, make_rmd = FALSE)

Arguments

block

a code block

make_rmd

if TRUE, the language will be wrapped in curly braces to be evaluated by RMarkdown

Details

print("code goes " + "here")

: .language-python

However, there is a simpler syntax that we can use:

print("code goes " + "here")

This will take in a code block and convert it so that it will no longer use the liquid tag (which we have added as a "ktag" attribute for "kramdown" tag)

Value

the node, invisibly.

Examples


frg1 <- Lesson$new(lesson_fragment())
frg2 <- frg1$clone(deep = TRUE)
py1  <- get_code(frg1$episodes[["17-scope.md"]]$body, ".language")
py2  <- get_code(frg2$episodes[["17-scope.md"]]$body, ".language")
py1
invisible(lapply(py1, liquid_to_commonmark, make_rmd = FALSE))
invisible(lapply(py2, liquid_to_commonmark, make_rmd = TRUE))
py1
py2

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