Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xaringan presentation not displaying html widgets, even when knitting provided template #293

Closed
vcannataro opened this issue Jan 18, 2021 · 5 comments

Comments

@vcannataro
Copy link

vcannataro commented Jan 18, 2021

The HTML widgets that are typically functional within xaringan presentations are not showing up / rendering on the slides for me. Even when I knit the provided template. As a reproducible example, when I knit this minimal chunk of the provided template:

---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
institute: "RStudio, PBC"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---
options(htmltools.dir.version = FALSE)
DT::datatable(
  head(iris, 10),
  fillContainer = FALSE, options = list(pageLength = 8)
)

My slide 2 looks like this: https://i.stack.imgur.com/HsTy1.png

This is true whether I knit in RStudio with the knit button, or use xaringan::infinite_moon_reader(), and the output also looks like this whether I view the .html file from within the RStudio viewer, Firefox, or Safari.

If I change the beginning of the document to be output: ioslides_presentation or html_document, they are rendered perfectly fine within the output. Here is my session info:

> xfun::session_info('xaringan')
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16, RStudio 1.4.1103

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3 BH_1.75.0.0     digest_0.6.27  
  evaluate_0.14   glue_1.4.2      graphics_4.0.3 
  grDevices_4.0.3 highr_0.8       htmltools_0.5.1
  httpuv_1.5.5    jsonlite_1.7.2  knitr_1.30.4   
  later_1.1.0.1   magrittr_2.0.1  markdown_1.1   
  methods_4.0.3   mime_0.9        promises_1.1.1 
  R6_2.5.0        Rcpp_1.0.6      rlang_0.4.10   
  rmarkdown_2.6   servr_0.21      stats_4.0.3    
  stringi_1.5.3   stringr_1.4.0   tinytex_0.28   
  tools_4.0.3     utils_4.0.3     xaringan_0.19.1
  xfun_0.20       yaml_2.2.1     

And I just updated RStudio today :
Version 1.4.1103
© 2009-2021 RStudio, PBC
"Wax Begonia" (458706c3, 2021-01-06) for macOS

perhaps also useful:

> rmarkdown::pandoc_version()
[1] ‘2.11.2’

Any advice is appreciated! Thank you all for these wonderful packages!

Note that I originally posted this issue on https://stackoverflow.com/questions/65766516/xaringan-presentation-not-displaying-html-widgets-even-when-knitting-provided-t , where someone else mentioned the same issue and suggested I post here.


By filing an issue to this repo, I promise that

  • [ x] I have fully read the issue guide at https://yihui.org/issue/.
  • [x ] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('xaringan'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/xaringan').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [ x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@gadenbuie
Copy link
Contributor

gadenbuie commented Jan 18, 2021

I can reproduce this. The problem is related to a recent change in rmarkdown, specifically in version 2.6. The new update now uses pandoc's raw HTML feature to protect the HTML for HTML widgets, but this doesn't work with xaringan because the slides' markdown is processed in the browser by a JavaScript markdown library, not pandoc.

This should probably be fixed in xaringan, but for now you can set the htmltools.preserve.raw option to fix this:

options(htmltools.preserve.raw = FALSE)

You could do this in the setup chunk:

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE, htmltools.preserve.raw = FALSE)
```

@vcannataro
Copy link
Author

Using options(htmltools.preserve.raw = FALSE) solved my issue, thank you! Should I close this github issue or leave it open since you may still try a fix within xaringan?

@shah-in-boots
Copy link

I had the same issue @vcannataro, just discovered it this morning. By using options(htmltools.preserve.raw = FALSE), the problem resolved. Thanks for the insight @gadenbuie .

yihui added a commit to rstudio/rmarkdown that referenced this issue Jan 19, 2021
…en this option has been set, otherwise it is impossible for other packages to turn this option off, e.g., yihui/xaringan#293
@yihui yihui closed this as completed in b4a7b15 Jan 19, 2021
@yihui
Copy link
Owner

yihui commented Jan 19, 2021

Should be fixed in the development version now:

remotes::install_github('yihui/xaringan')

Thanks for the report! (And thanks @gadenbuie for identifying the root cause!)

jonathan-g added a commit to jonathan-g/rmarkdown that referenced this issue Jan 25, 2021
Merge branch 'master' of https://github.com/rstudio/rmarkdown

* 'master' of https://github.com/rstudio/rmarkdown: (111 commits)
  get rid of names, otherwise the returned vector will have names like this:
  Only run testrmd if pandoc is available
  Warn that cropping is disabled if pdfcrop or ghostscript are not found. (rstudio#2017)
  Add shiny to remotes (rstudio#2014)
  file.path.ci is too loose with file matching (rstudio#2012)
  improve error messages for the new theme argument behavior
  Add Bootstrap 4 support (rstudio#1706)
  amend rstudio#1965: 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
  htmltools 0.5.1 is on CRAN now
  remove download stats
  use on.exit to remove file (rstudio#2001)
  use only the TinyTeX-1 version in CI (rstudio#1998)
  Cache should work on Windows with recent version of R (rstudio#1997)
  exclude renv folder from render_site() copied resources (rstudio#1996)
  Update CI to last Pandoc 2.11.3.1 (rstudio#1992)
  Revert "return div not nil for non-qualifying latex div"
  Add missing NEWS item for v2.6 release
  return div not nil for non-qualifying latex div
  Add `output_format_filter` function to `default_site_generator()`. (rstudio#1989)
  Improvements to latex-div (rstudio#1984)
  ...

# Conflicts:
#	NEWS.md
#	R/render.R
#	man/render.Rd
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this issue Jan 25, 2021
* master: (111 commits)
  get rid of names, otherwise the returned vector will have names like this:
  Only run testrmd if pandoc is available
  Warn that cropping is disabled if pdfcrop or ghostscript are not found. (rstudio#2017)
  Add shiny to remotes (rstudio#2014)
  file.path.ci is too loose with file matching (rstudio#2012)
  improve error messages for the new theme argument behavior
  Add Bootstrap 4 support (rstudio#1706)
  amend rstudio#1965: 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
  htmltools 0.5.1 is on CRAN now
  remove download stats
  use on.exit to remove file (rstudio#2001)
  use only the TinyTeX-1 version in CI (rstudio#1998)
  Cache should work on Windows with recent version of R (rstudio#1997)
  exclude renv folder from render_site() copied resources (rstudio#1996)
  Update CI to last Pandoc 2.11.3.1 (rstudio#1992)
  Revert "return div not nil for non-qualifying latex div"
  Add missing NEWS item for v2.6 release
  return div not nil for non-qualifying latex div
  Add `output_format_filter` function to `default_site_generator()`. (rstudio#1989)
  Improvements to latex-div (rstudio#1984)
  ...
clrpackages pushed a commit to clearlinux-pkgs/R-rmarkdown that referenced this issue Feb 23, 2021
… 2.7

Carson Sievert (3):
      Add Bootstrap 4 support (#1706)
      Add shiny to remotes (#2014)
      Close #2015: Fix bug in ToC's grid markup and make sure code download's dropdown menu is right aligned (#2020)

Christophe Dervieux (9):
      Update CI to last Pandoc 2.11.3.1 (#1992)
      Cache should work on Windows with recent version of R (#1997)
      use only the TinyTeX-1 version in CI (#1998)
      file.path.ci is too loose with file matching (#2012)
      Warn that cropping is disabled if pdfcrop or ghostscript are not found. (#2017)
      GHA improvements (#2029)
      set gfm_auto_identifiers to input format if toc is TRUE (#2040)
      Fix for knit_print.data.frame (#2050)
      Only keep the first url in citation  (#2041)

Hadley Wickham (1):
      Enable pkgdown/downlit cross-package links to rmarkdown (#1843)

J.J. Allaire (2):
      Improvements to latex-div (#1984)
      Add `output_format_filter` function to `default_site_generator()`. (#1989)

JJ Allaire (2):
      return div not nil for non-qualifying latex div
      Revert "return div not nil for non-qualifying latex div"

Jannik Buhr (1):
      exclude renv folder from render_site() copied resources (#1996)

Michael Chirico (1):
      use on.exit to remove file (#2001)

Yihui Xie (10):
      start the next version
      remove download stats
      htmltools 0.5.1 is on CRAN now
      amend #1965: 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
      get rid of names, otherwise the returned vector will have names like this:
      tweak news
      use CRAN releases of shiny and bslib
      amend 62ae2eddaf4ca95176c7424d23658f5d8b0e014a and #1989: make sure output_format_filter is a function; testing NULL is not enough, e.g., the radix package still calls
      place <div> in \code{}
      CRAN release v2.7

atusy (1):
      Eliminate the unnecessary padding in code blocks in the `html_document` output with Bootstrap 4 themes (#2019)

christophe dervieux (11):
      Add pkgdown actions for current https://rmarkdown.rstudio.com/docs/
      use the netlify CLI directly
      Add NETLIFY_SITE_ID
      fix line numbering in code chunk when .numberlines is used
      Add missing NEWS item for v2.6 release
      improve error messages for the new theme argument behavior
      Only run testrmd if pandoc is available
      user agent should be on r-devel
      don't run R CMD check when we make change to pkgdown workflow or website config
      it is yaml not yml
      update CONTRIBUTING.md
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jun 12, 2021
rmarkdown 2.8
================================================================================

- Fix a issue with Pandoc 2.5 and `latex-div.lua` - documents can now
  be rendered as expected without error (thanks, @DAVIDWALES, #2121).

- Fix an issue with styling and code folding button behavior when
  default is `code-folding: show`. The Button can now be correctly
  style according to state as `aria-expanded` attributes is correctly
  updated. Also, new classes has been added on the button to allow
  styling during transition: `btn-collapsing` and `btn-expanding` are
  respectively applied during transition Show to Hide and Hide to
  Show. (This follow [Bootstrap behavior for the collapsible
  block](https://getbootstrap.com/docs/3.4/javascript/#collapse))
  (thanks, @steveharoz, #2085).

- Fix an issue with `citation_package` having no effect when using
  `.md` file as input to `render()` with latex and PDF output formats
  (thanks, @andrewheiss, #2113).

- A new internal option `rmarkdown.knit.ext` has been added to control
  the extension of the intermediary knit output during a rendering. It
  defaults to `md` to produce `*.knit.md`. Only useful for very
  advanced usage (#2098).

- `render()` won't produce any `*.utf8.md` intermediary file
  anymore. This was a leftover from previous versions of
  **rmarkdown**. Since **knitr** 1.24 and **rmarkdown** 2.0, only
  UTF-8 input files are allowed. (#2098).

- Fix an `Invalid cross-device link` error when `tempdir()` is used
  for `intermediates_dir` in `render()` (thanks, @gorgitko, #2096).

- Fix a regression in HTML default template with floating toc
  incorrectly placed on small size window (thanks, @grimbough, #2071)

- Provided a `runtime: shiny` fix for output formats that pass a
  modified `bslib::bs_theme()` object to `html_document_base()`'s
  `theme` (thanks, @cpsievert, #2049).

- Rendering using `runtime: shiny_prerendered` or `runtime: shinyrmd`
  will now produce valid HTML by not inserting anymore the full
  document as body in the resulting shiny apps (thanks, @dakep,
  #1912). Header content usually containing html dependencies will be
  inserted in the HTML document at the end of the head before
  `</head>`, unless the rendered HTML contains `<!-- HEAD_CONTENT -->`
  special comment (see `htmltools::renderDocument()`). A new Pandoc
  variable is set in for shiny prerendered document to allow
  conditional insertion of such content in the the HTML template using
  `$if(shiny-prerendered)$`. This has been done in all HTML template
  in this package. Users of custom template should make this change to
  provide support for this runtime. See **rmarkdown** default template
  (`default.html`) for an example (#2064).

- Added `tectonic` as a supported LaTeX engine for generating PDF
  output (thanks, @dpryan79, #2078). You can specify to use this by
  adding `engine: "tectonic"` to your output format in YAML, such as
  `pdf_document`.

- When no `output_format` is provided in any way but an `output_file`
  is provided in `render()`, the default format will be determined
  based on the extension: `"pdf_document"` for `.pdf`, or
  `"word_document"` for `.docx`. Otherwise, it will be
  `"html_document"` as previous version (thanks, @pearsonca, #1569).

- Added a new global option `rmarkdown.render.message`. When set
  `FALSE`, `render()` will not output the message starting by `Output
  created: ` allowing RStudio IDE to open a preview of the
  document. This is useful for package developers that would need to
  emit there own output message for there custom format. See
  `?render_site` for more info on this special message (#2092).

- Internal changes regarding Lua filters. They have now an explicit
  Pandoc version minimal requirement: A filter will be skipped with a
  warning printed by the Lua filter if this requirement is not
  met. For now, all filters work for Pandoc 2.1 and above (thanks,
  @atusy, #2088). There is also now a new mechanism to have a share
  Lua filter script loadable by other Lua files: `render()` will set
  the `RMARKDOWN_LUA_SHARED` env var to the path of Lua filter
  `shared.lua` so that other filters can access functions defined in
  it using `dofile(os.getenv 'RMARKDOWN_LUA_SHARED')`. This is for
  internal usage only to avoid duplication (thanks, @tarleb, #2103).

- `html_document_base` gains a `css` argument, to which
  `html_document`'s `css` argument is now passed. This also fix an
  issue when `.sass` or `.scss` files are used with this `css`
  argument when `self_contained: FALSE`. Moreover, **sass** caching
  mechanism can now be used when passing `.sass` or `.scss` files to
  the `css` argument (thanks, @cpsievert, #2095).

- The `fig_crop` option of PDF document formats (such as
  `pdf_document` and `beamer_presentation`) supports the value
  `"auto"` now, which means `fig_crop = TRUE` when figure cropping
  tools `pdfcrop` and `ghostscript` are available.

- The default value of the `fig_crop` option of PDF output formats has
  been changed from `TRUE` to `"auto"` (#2077).

- `rmarkdown::tufte_handout` has been deprecated and will be removed
  in the future from this package. It has been moved to the **tufte**
  package since **rmarkdown** 0.9.5 (released on 2016-02-22). Please
  use `tufte::tufte_handout` instead.


rmarkdown 2.7
================================================================================

- `html_document` (and `html_document_base`)'s `theme` parameter now
  understands `bslib::bs_theme()` objects/arguments, meaning that one
  may opt-into Bootstrap 4 and more easily create custom themes. For
  examples, see <rstudio/rmarkdown#1706>, and
  for context, see <https://rstudio.github.io/bslib/> (thanks,
  @cpsievert, #1706).

- Files with `.scss`/`.sass` extension (i.e., Sass files) provided to
  `html_document`'s `css` parameter are now compiled to CSS using the
  `{sass}` package. Also, if `theme` is a `{bslib}` object, these Sass
  files may utilize Sass code inside the `theme` (thanks, @cpsievert,
  #1706).

- Fix an issue with line numbering in code chunks when `.numberlines`
  with Pandoc's highlighting (thanks, @aosavi, #1876).

- Fix an issue with shiny runtime and `global.R` (thanks,
  @liaojiahui-r, rstudio/flexdashboard#298).

- Accept `latex="{options}"`, `latex=1`, or `latex=true` for Latex
  Divs.

- Add `output_format_filter` function to
  `default_site_generator()`. Enables custom site generators to
  customize or even entirely replace the output format right before
  rendering of each page.

- 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.

- `knitr_options_pdf()` will now throw a warning when `fig_crop =
  TRUE` but is disabled because required tools `pdfcrop` and/or
  `ghostscript` are missing (thanks, @netique, #2016).

- Eliminated the unnecessary padding in code blocks in the
  `html_document` output with Bootstrap 4 themes (thanks, @atusy,
  #2019).

- `github_document()` will produce a working TOC even if some headers
  start with number (#2039).

- Fix an issue with `knit_print.data.frame`. The `...` arguments are
  no more passed to `print()` to avoid passing `knit_print()`
  arguments `options` and `encoding` to custom `print()` methods
  (#2047).

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

- Encoding is correctly handled now in `html_vignette` when checking
  for identical title and vignette index entry (thanks, @py-b, #1978).

- `clean_site()` now default to `preview = TRUE` and will no more
  remove files without notice. This change will affect the "Clean All"
  button in the "Build" pane for website project. `clean_site(preview
  = FALSE)` must be run to effectively remove files (#1973).

- The intermediate `.tex` file is now correctly deleted if `keep_tex =
  FALSE` when the R Markdown document is not rendered from the working
  directory (thanks, @vqv, #1308).

- Fix a bug causing certain resources files to be deleted as
  intermediate files when `intermediates_dir` is the same as the input
  (thanks, @bellma-lilly, #1248).

- Fix issues with `anchor_sections = TRUE` and **learnr** (thanks,
  @gadenbuie, #1938).

- Enable use of `server.R` and `global.R` alongside `runtime:
  shinyrmd` documents.

- `pkg_file_lua()` now works with `devtools::load_all()` and
  **testthat** when used in other packages.

- Fix `pandoc_convert(citeproc = TRUE)` not supressing the `--natbib`
  or `--biblatex` options (thanks, @atusy, #1932).

- `pandoc-citeproc` is now activated if a `bibliography` field is
  defined in another YAML block instead of the first YAML block
  (thanks, @bwiernik, #1364).

- Specify that `htmltools::htmlPreserve()` should use the pandoc raw
  attribute rather than preservation tokens when pandoc >= v2.0. Note
  that this option will have the intended effect only for versions of
  htmltools >= 0.5.0.9003.

- `anchor_sections` in `html_documents()` now defaults to `FALSE`. It
  was introduced in previous version with a default to `TRUE`, but it
  is reverted now after hearing feedbacks from the community (thank
  you!). The `#` is still used as the character for the anchor but you
  can easily change that using CSS rules. Examples have been added to
  the help page `?html_document`.

- Using Pandoc's default for `--email-obfuscation` now. Previously, it
  was set to `none` explicitly, which is the default for Pandoc
  1.17.2+ anyway. Only users with a Pandoc version before 1.17.2 may
  see a change in the content of the html source file produced if the
  document contains email addresses. This change allows to pass the
  Pandoc's command line flag if you want to set it to another value
  (thanks,@seankross, #1969).

  ````yaml
  output:
    html_document:
      pandoc_args: ["--email-obfuscation", "javascript"]
  ````

  See [Pandoc's
  manual](https://pandoc.org/MANUAL.html#option--email-obfuscation)
  for the meaning of this option.

- 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
================================================================================

- Tables without header rows (wich can be possible in Pandoc's [simple
  table](https://pandoc.org/MANUAL.html#extension-simple_tables)) are
  now formatted correctly when using `html_document()` format (thanks,
  @fkohrt, #1893).

- `html_document()` gains the `anchor_sections` argument, which is
  `TRUE` by default, so that readers can get links to section headers
  easily---when you mouse over a section header, you will see a hash
  symbol `#` at the end of the header, which contains the anchor link
  to this header. You can click on this link and get the URL in the
  addres bar of your web browser, or right-click on it and copy the
  URL from the context menu. The hash symbol is defined by the CSS
  rule `a.anchor-section::before {content: '#';}`. You can customize
  it by overriding this rule (e.g., via the `css` argument of
  `html_document`) and use any other symbols or icons, e.g., `content:
  "\02AD8;"` (thanks, @atusy, #1884).

- `pkg_file_lua()` should have thrown an error if the expected Lua
  file does not exist.

- Provide `files_dir` and `intermediates_dir` as attributes on return
  from `render()` when `run_pandoc = FALSE`.

- Supports new Pandoc 2.11 `--citeproc` flags usage instead of
  `pandoc-citeproc` external filter. `pandoc_convert()` and
  `pandoc_citeproc_convert()` will now use the correct flags according
  to the Pandoc version used. The logic is exported in
  `pandoc_citeproc_args()`. See [Pandoc release
  note](https://github.com/jgm/pandoc/releases/tag/2.11) for more
  information about the new `citeproc` processing (#1916).

- Fixed the code highlighting when code block is hidden. Previous
  version introduced a regression where non default code highlighting
  was still shown when `code_folding` is activated and code block is
  hidden (thanks, @matthewcarlucci, #1921).

- The minimal required version for the **xfun** package (v0.15) has
  been specified for R Markdown Notebooks to work properly (thanks,
  @jmcphers, #1923).

- Fixed a bug in `convert_ipynb()` when the language is not specified
  in the `.ipynb` file (thanks, @acca3003, #1925).

- Introduce `runtime: shinyrmd` as a more user friendly alias for
  `runtime: shiny_prerendered`.


rmarkdown 2.4
================================================================================

- Lua filters handling has been improved internally with some
    - user-facing changes (#1899): New exported function
    - `pandoc_lua_filter_args()` to return the Pandoc command-line
    - argument to add a Lua filter.  New argument `lua_filters` in
    - `pandoc_options()` to pass the Lua filter paths to use with a
    - format. This allow output format authors to add filters for a
    - custom format using the `pandoc` argument of `output_format()`
    - and to get filters from a format using `fmt$pandoc$lua_filters`.
    - The Lua filters of an output format are now passed to Pandoc in
    - `render()`. By default, they are passed to Pandoc before any
    - other format-defined or user-defined Pandoc arguments (usually
    - via the `pandoc_args` option of an output format). This ensures
    - that filters of an output format are executed first. To change
    - the default, you need to deal with it in a custom format (i.e.,
    - modify the elements in `fmt$pandoc$lua_filters`, such as
    - reordering them).  New exported function `pkg_file_lua()` to get
    - the full system path of a Lua filter included in a package
    - source within the `inst/rmarkdown/lua` folder (thanks, @atusy,
    - #1903).

- Fixed the path separators for the `css` parameter in YAML
  frontmatter for HTML output files under Windows. Previously, forward
  slashes in `css` paths were converted to backslashes (thanks,
  @jonathan-g, #1862).

- Since **rmarkdown** 1.16, Pandoc's fenced `Div`'s are converted to
  LaTeX environments when the output format is LaTeX, e.g., `:::
  {.center data-latex=""}` is converted to `\begin{center}`. The
  attribute `data-latex` of the `Div` was mandatory, even if it is
  empty. In **rmarkdown** 2.2, we silently drop this requirement,
  which means `::: {.center}` is converted to `\begin{center}`. This
  turns out to be a bad idea, because users have no control over which
  Div's to be converted to LaTeX environments. Previously, they could
  opt-in by the `data-latex` attribute, but with **rmarkdown** 2.3,
  all Div's are converted to LaTeX environments
  unconditionally. What's more, this change led to bugs like
  https://stackoverflow.com/q/62340425/559676 and
  rstudio/bookdown#883. Therefore the
  `data-latex` attribute became mandatory again in this version. If
  the LaTeX environment does not need arguments, you may use
  `data-latex=""`.

- The two Lua fitlers `pagebreak.lua` and `latex-div.lua` (introduced
  in **rmarkdown** 1.16) are also applied to the output format
  `beamer_presentation` now (thanks, @XiangyunHuang, #1815).

- When customizing formats with the `output_format` function,
  `pre_knit`, `opts_hooks`, and `knit_hooks` can now refer to
  `rmarkdown::metadata`. Previously, `rmarkdown::metadata` returned
  `list()` in these functions (thanks, @atusy, #1855).

- `rmarkdown::find_external_resources()` now discovers external
  template files. This in turn fixes the rendering issue of
  `html_document` with the `shiny` runtime and `intermediate_dir` set
  (thanks, @atusy, @cderv, #1865).

- Added the `number_sections` argument to following formats:
  `github_document`, `ioslides_presentation`, `md_document`,
  `odt_document`, `powerpoint_presentation`, `rtf_document`,
  `slidy_presentation`, `word_document`. These are powered by a Lua
  filter and requires Pandoc > 2.0. It will silently have no effect
  has before with previous pandoc version (thanks @atusy 1893).
  Pandoc >= 2.10.1 adds `--number-sections` for docx format, and thus
  `word_document` prefers the native feature to the Lua filter
  (thanks, @jooyoungseo, #1869).

- For the output format `pdf_document`, the option `fig_crop` will not
  be enabled unless both the programs `pdfcrop` and `ghostscript` are
  found (thanks, @dalupus, yihui/knitr#954).

- Fixed a bug that a chunk with a class `fold-hide` hides the rest of
  the chunks even the output format setting
  `html_document(code_folding = "show")` (thanks, @atusy, #1906).

- Updated documentation for `render()` to make it clearer how options
  are set for the `output_format` parameter (thanks, @jonathan-g,
  #1907 and rstudio/bookdown#930).

- Ported some CSS styles (e.g., underlines, small caps, and
  multi-column layouts) from the latest Pandoc's HTML template into
  **rmarkdown**s HTML templates (thanks, @atusy, #1878, #1908).
@jorgesinval
Copy link

I can reproduce this. The problem is related to a recent change in rmarkdown, specifically in version 2.6. The new update now uses pandoc's raw HTML feature to protect the HTML for HTML widgets, but this doesn't work with xaringan because the slides' markdown is processed in the browser by a JavaScript markdown library, not pandoc.

This should probably be fixed in xaringan, but for now you can set the htmltools.preserve.raw option to fix this:

options(htmltools.preserve.raw = FALSE)

You could do this in the setup chunk:

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE, htmltools.preserve.raw = FALSE)

If I use your js4shiny package:

js4shiny::html_setup(stylize = c("fonts", "variables", "code"))

setting the options (options(htmltools.dir.version = FALSE, htmltools.preserve.raw = FALSE)) will not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants