diff --git a/.github/actions/checkout-knitr-examples/action.yml b/.github/actions/checkout-knitr-examples/action.yml index 9e3196a2c0..51b4cf8f5e 100644 --- a/.github/actions/checkout-knitr-examples/action.yml +++ b/.github/actions/checkout-knitr-examples/action.yml @@ -18,7 +18,7 @@ runs: echo '::debug::On pull request' branch=$(gh api repos/yihui/knitr-examples/branches | jq -cr '.[] | select(.name == '\"$headref\"') | .name') fi - echo ::set-output name=ref::$(echo $branch) + echo "ref=$(echo $branch)" >> "$GITHUB_OUTPUT" shell: bash - name: Retrieve knitr-examples uses: actions/checkout@v2 diff --git a/DESCRIPTION b/DESCRIPTION index d373138e9a..ac33568f9c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: knitr Type: Package Title: A General-Purpose Package for Dynamic Report Generation in R -Version: 1.47.1 +Version: 1.47.2 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"), diff --git a/NEWS.md b/NEWS.md index 9d7f279cf5..b9916a8c10 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # CHANGES IN knitr VERSION 1.48 +## BUG FIXES + +- Fix regression from 1.46 with `collapse = TRUE` option not correctly collapsing source code and output into one when code chunk returns multiple outputs (thanks, @jennybc, @florisvdh, tidyverse/reprex#463). # CHANGES IN knitr VERSION 1.47 diff --git a/R/hooks-md.R b/R/hooks-md.R index a072f1b71e..f2443f9aee 100644 --- a/R/hooks-md.R +++ b/R/hooks-md.R @@ -199,7 +199,7 @@ hooks_markdown = function(strict = FALSE, fence_char = '`') { x = gsub('[\n]+$', '', x) x = gsub('^[\n]+', '\n', x) if (isTRUE(options$collapse)) { - r = sprintf('\n([%s]{3,})\n+\\1((\\{[.])?%s[^\n]*)?\n', fence_char, tolower(options$engine)) + r = sprintf('\n([%s]{3,})\n+\\1((\\{[.]| )?%s[^\n]*)?\n', fence_char, tolower(options$engine)) x = gsub(r, '\n', x) x = gsub(asis_token, '', x, fixed = TRUE) }