Skip to content

Commit

Permalink
Add a new targets engine (#2031)
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Jul 28, 2021
1 parent d65b923 commit 55a2df9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 9 additions & 1 deletion R/engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down

0 comments on commit 55a2df9

Please sign in to comment.