xaringan 演示文稿不显示 html 小部件,即使在编织提供的模板时也是如此
xaringan presentation not displaying html widgets, even when knitting provided template
应该在 xaringan 演示文稿中工作的 HTML 小部件没有为我显示/呈现在幻灯片上。即使我编织提供的模板。作为一个可重现的例子,当我编织时:
---
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)
)
我得到的幻灯片 2 是:
screenshot of issue
我想在我的演示文稿中包含 DT::datatable() 表格。他们目前可以很好地融入其他 RMarkdown 文档,例如 ioslides_presentation 和 html_document。这是我的会话信息
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.17.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 rstudioapi_0.13 knitr_1.30.4 servr_0.21 magrittr_2.0.1
[6] R6_2.5.0 rlang_0.4.10 fansi_0.4.2 stringr_1.4.0 tools_4.0.3
[11] xfun_0.20 xaringan_0.19.1 sessioninfo_1.1.1 cli_2.2.0 withr_2.4.0
[16] htmltools_0.5.1 crosstalk_1.1.1 assertthat_0.2.1 yaml_2.2.1 digest_0.6.27
[21] crayon_1.3.4 later_1.1.0.1 htmlwidgets_1.5.3 promises_1.1.1 rsconnect_0.8.16
[26] glue_1.4.2 evaluate_0.14 mime_0.9 rmarkdown_2.6 stringi_1.5.3
[31] compiler_4.0.3 jsonlite_1.7.2 httpuv_1.5.5
我今天刚刚更新了 RStudio:
版本 1.4.1103
© 2009-2021 RStudio, 中国人民银行
"蜡海棠" (458706c3, 2021-01-06) for macOS
也许还有用:
> rmarkdown::pandoc_version()
[1] ‘2.11.2’
如有任何建议,我们将不胜感激!
最近对 rmarkdown 的更新(2.6 版)改变了 HTML 小部件如何包含在输出文件中以使用 pandoc 的原始 HTML 块。不幸的是,此功能与 xaringan 使用的 JavaScript markdown 库不兼容。您可以通过设置
禁用此功能并解决 xaringan 幻灯片中 htmlwidgets 的问题
options(htmltools.preserve.raw = FALSE)
这是相关的 NEWS entry from rmarkdown 2.6:
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.
应该在 xaringan 演示文稿中工作的 HTML 小部件没有为我显示/呈现在幻灯片上。即使我编织提供的模板。作为一个可重现的例子,当我编织时:
---
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)
)
我得到的幻灯片 2 是:
screenshot of issue
我想在我的演示文稿中包含 DT::datatable() 表格。他们目前可以很好地融入其他 RMarkdown 文档,例如 ioslides_presentation 和 html_document。这是我的会话信息
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.17.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 rstudioapi_0.13 knitr_1.30.4 servr_0.21 magrittr_2.0.1
[6] R6_2.5.0 rlang_0.4.10 fansi_0.4.2 stringr_1.4.0 tools_4.0.3
[11] xfun_0.20 xaringan_0.19.1 sessioninfo_1.1.1 cli_2.2.0 withr_2.4.0
[16] htmltools_0.5.1 crosstalk_1.1.1 assertthat_0.2.1 yaml_2.2.1 digest_0.6.27
[21] crayon_1.3.4 later_1.1.0.1 htmlwidgets_1.5.3 promises_1.1.1 rsconnect_0.8.16
[26] glue_1.4.2 evaluate_0.14 mime_0.9 rmarkdown_2.6 stringi_1.5.3
[31] compiler_4.0.3 jsonlite_1.7.2 httpuv_1.5.5
我今天刚刚更新了 RStudio: 版本 1.4.1103 © 2009-2021 RStudio, 中国人民银行 "蜡海棠" (458706c3, 2021-01-06) for macOS
也许还有用:
> rmarkdown::pandoc_version()
[1] ‘2.11.2’
如有任何建议,我们将不胜感激!
最近对 rmarkdown 的更新(2.6 版)改变了 HTML 小部件如何包含在输出文件中以使用 pandoc 的原始 HTML 块。不幸的是,此功能与 xaringan 使用的 JavaScript markdown 库不兼容。您可以通过设置
禁用此功能并解决 xaringan 幻灯片中 htmlwidgets 的问题options(htmltools.preserve.raw = FALSE)
这是相关的 NEWS entry from rmarkdown 2.6:
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.