Skip to content

Commit

Permalink
provide a chunk option ref.chunk = FALSE to disable chunk references …
Browse files Browse the repository at this point in the history
…`<<label>>` (#2360)
  • Loading branch information
yihui committed Sep 18, 2024
1 parent fdeba9a commit 9fc5478
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.48.2
Version: 1.48.3
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGES IN knitr VERSION 1.49

## NEW FEATURES

- In-chunk references of the form `<<label>>` can be disabled via the chunk option `ref.chunk = FALSE` now (thanks, @jennybc @gadenbuie, #2360).

## BUG FIXES

- In-chunk references of the form `<<label>>` should not be resolved if `label` is not found in the document (thanks, @jennybc @gadenbuie, #2360).
Expand Down
3 changes: 2 additions & 1 deletion R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ call_block = function(block) {

if (opts_knit$get('progress')) print_block(block)

params[['code']] = parse_chunk(params[['code']]) # parse sub-chunk references
if (!isFALSE(params$ref.chunk))
params[['code']] = parse_chunk(params[['code']]) # parse sub-chunk references

ohooks = opts_hooks$get()
for (opt in names(ohooks)) {
Expand Down

0 comments on commit 9fc5478

Please sign in to comment.