From 55a2df9353af1157b3954a968cfef5c1e30dd64c Mon Sep 17 00:00:00 2001 From: Will Landau Date: Wed, 28 Jul 2021 14:14:43 -0400 Subject: [PATCH] Add a new targets engine (#2031) --- DESCRIPTION | 3 ++- NEWS.md | 2 ++ R/engine.R | 10 +++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4fd333ba77..3092d33f5d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -142,7 +142,8 @@ Suggests: sass, bslib, ragg, - styler (>= 1.2.0) + styler (>= 1.2.0), + targets (>= 0.6.0) License: GPL URL: https://yihui.org/knitr/ BugReports: https://github.com/yihui/knitr/issues diff --git a/NEWS.md b/NEWS.md index ed08c26400..8902da3ad2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ - For the `tikz` engine, the class options of the `standalone` document classs can be specified via the chunk option `engine.opts$classoption` (thanks, @XiangyunHuang, #1985). The default value is `tikz`, i.e., `\documentclass[tikz]{standalone}` is used by default. +- Added a new `targets` engine (https://github.com/ropensci/targets/issues/503, @wlandau). Details: https://books.ropensci.org/targets/markdown.html. + ## MAJOR CHANGES - An error is now thrown when an inline code result is not coercible to character. This has always been the assumed behavior but it happens to be different in certain formats with unknown automatic coercion. This is now enforced to prevent any unexpected output. An inline code expression must evaluate to a character vector or an object coercible by `as.character()` (#2006). diff --git a/R/engine.R b/R/engine.R index 44a12657d3..a571489835 100644 --- a/R/engine.R +++ b/R/engine.R @@ -765,6 +765,14 @@ eng_bslib = function(options) { eng_sxss(options) } +# Target Markdown engine contributed by @wlandau +# Thread: https://github.com/ropensci/targets/issues/503 +# Usage: https://books.ropensci.org/targets/markdown.html +# Docs: https://docs.ropensci.org/targets/reference/tar_engine_knitr.html +eng_targets = function(options) { + targets::tar_engine_knitr(options = options) +} + # set engines for interpreted languages local({ for (i in c( @@ -781,7 +789,7 @@ knit_engines$set( cat = eng_cat, asis = eng_asis, stan = eng_stan, block = eng_block, block2 = eng_block2, js = eng_js, css = eng_css, sql = eng_sql, go = eng_go, python = eng_python, julia = eng_julia, sass = eng_sxss, scss = eng_sxss, R = eng_r, - bslib = eng_bslib + bslib = eng_bslib, targets = eng_targets ) cache_engines$set(python = cache_eng_python)