使用教程包在 ioslides 演示中使用 datacamp light 练习

Using datacamp light exercises in an ioslides presentation using the tutorial package

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

    ---
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.: 迄今为止最好的结果是一个长字母数字字符串而不是浏览器中的控制台 window (Google Chrome).

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

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

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

导致生成的 HTML 代码未被修改。

要修复由 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>