tutorial 包允许在 html 文档中包含 datacamp 交互式 R 窗口:

    ---
title: "Example Document"
output:
  html_document:
    self_contained: FALSE
---

```{r, include=FALSE}
tutorial::go_interactive()
```

By default, `tutorial` will convert all R chunks.

```{r}
a <- 2
b <- 3

a + b
```

因此,我认为它可以在 HTML5 演示文稿中使用它,例如:
---
title: "Example Document"
output:
  ioslides_presentation:
    self_contained: FALSE
---

```{r, include=FALSE}
tutorial::go_interactive()
```

By default, `tutorial` will convert all R chunks.

```{r}
a <- 2
b <- 3

a + b
```

然而,这只会制造废话。
有没有人有让这个工作的经验?

P.S.:目前最好的结果是一个长的字母数字字符串,而不是浏览器窗口(谷歌浏览器)中的控制台。

最佳答案

在转换过程中,tutorial 包生成的 HTML 被编码。一个简单的解决方案是像这样包装你的块:

<!--html_preserve-->
```{r}
a <- 2
b <- 3

a + b
```
<!--/html_preserve-->

导致生成的 HTML 代码未受影响。

html - 使用教程包在 ioslides 演示文稿中使用 datacamp 轻量级练习-LMLPHP

要修复由 CSS 冲突导致的故障,您可以在文档的开头添加以下 CSS:
    <style>
/* Rearrange console label */
.datacamp-exercise ol li, .datacamp-exercise ul li {
  margin-bottom: 0em !important;
}

/* Remove bullet marker */
.datacamp-exercise ol li::before, .datacamp-exercise ul li::before {
  content: '' !important;
}
</style>

html - 使用教程包在 ioslides 演示文稿中使用 datacamp 轻量级练习-LMLPHP

关于html - 使用教程包在 ioslides 演示文稿中使用 datacamp 轻量级练习,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52081304/

10-11 23:04
查看更多