Skip to content

Commit

Permalink
knitr - Set always_allow_html: true for quarto render --to native
Browse files Browse the repository at this point in the history
… special format

This avoid triggering a rmarkdown error about HTML content being inserted in non-HTML formats
  • Loading branch information
cderv committed May 6, 2024
1 parent 78621ee commit a604268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion news/changelog-1.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ All changes included in 1.5:
- ([#9255](https://github.com/quarto-dev/quarto-cli/issues/9255)): Support cell source fields of type `string`.
- ([#9422](https://github.com/quarto-dev/quarto-cli/issues/9422)): Improve the stream merging algorithm in output cells to avoid merging outputs that should not be merged.
- ([#9536](https://github.com/quarto-dev/quarto-cli/issues/9536)): Provide traceback when available in Jupyter error outputs.
- ([#9470](https://github.com/quarto-dev/quarto-cli/issues/9470)): Fix images rendered by the Jupyter engine to be displayed with the same dimensions as those in notebooks.
- ([#9470](https://github.com/quarto-dev/quarto-cli/issues/9470)): Fix images rendered by the Jupyter engine to be displayed with the same dimensions as those in notebooks.

## Website Listings

Expand Down Expand Up @@ -176,3 +176,4 @@ All changes included in 1.5:
- When running `quarto check` from a development build (from a git repository), show the git commit hash in addition to the version string.
- Upgrade Deno to 1.41.0
- `quarto install tinytex` will now try to set the default CTAN repository to the nearest mirror resolved from https://mirror.ctan.org.
- `quarto render --to native` now works without triggering rmarkdown error about non HTML output when HTML dependencies are present in the knitr engine cell results.
2 changes: 1 addition & 1 deletion src/resources/rmd/execute.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ execute <- function(input, format, tempDir, libDir, dependencies, cwd, params, r
# This truly awful hack ensures that rmarkdown doesn't tell us we're
# producing HTML widgets when targeting a non-html format (doing this
# is triggered by the "prefer-html" options)
if (is_html_prefered(format)) {
if (is_html_prefered(format) || is_pandoc_to_format(format, c("native"))) {
render_env <- parent.env(parent.frame())
render_env$front_matter$always_allow_html <- TRUE
}
Expand Down

0 comments on commit a604268

Please sign in to comment.