简体   繁体   English

使用教程包在ioslides演示文稿中使用数据广播灯光练习

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

The tutorial packages allows to include a datacamp interactive R window in an html document: 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
```

I therefore thought it might be able to use it within an HTML5 presentation, for example like this: 因此我认为它可以在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
```

However, that only created nonsense. 但是,这只会造成废话。 Has anyone experience in getting this to work? 有没有经验让这个工作?

PS: The best result so far is a long alphanumeric string instead of a console in browser window (Google Chrome). PS:到目前为止,最好的结果是在浏览器窗口(Google Chrome)中使用长字母数字字符串而不是控制台。

In the converting process, the HTML generated by the tutorial package gets encoded. 在转换过程中, tutorial包生成的HTML将被编码。 An easy solution is to wrap your chunks like this: 一个简单的解决方案就是像这样包裹你的块:

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

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

leading to the HTML code generated being untouched. 导致生成的HTML代码不受影响。

在此输入图像描述

To fix the glitches resulting from CSS conflicts you can add the following CSS right at the beginning of your document: 要修复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>

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM