Get or set language engines for evaluating code chunks and inline code.

engines(...)

Arguments

...

Named values (for setting) or unnamed values (for getting).

Value

The usage is similar to reactor(): engines('LANG') returns an engine function for the language LANG, and engines(LANG = function(x, inline = FALSE, ...) {}) sets the engine for a language.

Details

An engine function should have three arguments:

  • x: An element in the crack() list (a code chunk or a text block).

  • inline: It indicates if x is from a code chunk or inline code.

  • ...: Currently unused but recommended for future compatibility (more arguments might be passed to the function).

The function should return a character value.

Examples

litedown::engines()  # built-in engines
#> List of 6
#>  $ css    :function (x, inline = FALSE, ...)  
#>  $ embed  :function (x, ...)  
#>  $ js     :function (x, inline = FALSE, ...)  
#>  $ md     :function (x, inline = FALSE, ...)  
#>  $ mermaid:function (x, inline = FALSE, ...)  
#>  $ r      :function (x, inline = FALSE, ...)