Skip to content

Commit

Permalink
amend #1965: do not force options(htmltools.preserve.raw = TRUE) wh…
Browse files Browse the repository at this point in the history
…en this option has been set, otherwise it is impossible for other packages to turn this option off, e.g., yihui/xaringan#293
  • Loading branch information
yihui committed Jan 19, 2021
1 parent d562ec8 commit 0a73180
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rmarkdown
Type: Package
Title: Dynamic Documents for R
Version: 2.6.4
Version: 2.6.5
Authors@R: c(
person("JJ", "Allaire", role = "aut", email = "jj@rstudio.com"),
person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ rmarkdown 2.7

- Automatically exclude renv directory for `render_site()` (thanks, @jmbuhr, #1996)

- Do not force `options(htmltools.preserve.raw = TRUE)` when this option has been set, otherwise it is impossible for other packages to turn this option off, e.g., yihui/xaringan#293.


rmarkdown 2.6
================================================================================

Expand Down Expand Up @@ -48,6 +51,7 @@ rmarkdown 2.6

- Fix Fontawesome 5 icons in navbar by correctly handling new prefix as `fa` has been deprecated in favor of `fas` or `fab` (#1967)


rmarkdown 2.5
================================================================================

Expand Down
13 changes: 6 additions & 7 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,13 @@ render <- function(input,
templates <- knitr::opts_template$get()
on.exit(knitr::opts_template$restore(templates), add = TRUE)

# specify that htmltools::htmlPreserve should use the pandoc raw
# attribute (e.g. ```{=html}) rather than preservation tokens when
# pandoc >= v2.0. Note that this option will have the intended effect
# only for versions of htmltools >= 0.5.1.
# specify that htmltools::htmlPreserve() should use the Pandoc raw attribute
# by default (e.g. ```{=html}) rather than preservation tokens when pandoc
# >= v2.0. Note that this option will have the intended effect only for
# versions of htmltools >= 0.5.1.
if (pandoc2.0() && packageVersion("htmltools") >= "0.5.1") {
prev <- getOption("htmltools.preserve.raw", default = NA)
options(htmltools.preserve.raw = TRUE)
if (!is.na(prev)) {
if (is.null(prev <- getOption("htmltools.preserve.raw"))) {
options(htmltools.preserve.raw = TRUE)
on.exit(options(htmltools.preserve.raw = prev), add = TRUE)
}
}
Expand Down

0 comments on commit 0a73180

Please sign in to comment.