在我的 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)
)
我的幻灯片第二页只显示了这个: 问题的截图 我想在我的演示文稿中包含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,PBC "Wax Begonia" (458706c3, 2021-01-06) 适用于macOS。
或许这也有用:
> rmarkdown::pandoc_version()
[1] ‘2.11.2’
任何建议都将不胜感激!
output: xaringan::moon_reader
改为output: html_document
,那么HTML小部件就可以在标准HTML文档输出中完美呈现。 - vcannataro