R 在ioslides中启用高亮显示模式开始

R 在ioslides中启用高亮显示模式开始,r,markdown,r-markdown,presentation,ioslides,R,Markdown,R Markdown,Presentation,Ioslides,在使用Rmarkdown演示时,可以通过按h在每张幻灯片中选择。是否有办法使高亮显示模式在默认情况下处于启用状态,并通过按h禁用高亮显示模式默认情况下没有内置选项。 这来自以下几行JavaScript:and. 当扬声器更改幻灯片时,高亮显示模式将被删除 但是,默认情况下,有一种不常用的方法来突出显示每张幻灯片。 在项目中,创建一个新文件(例如命名为highlight.html)。 在此文件中,复制以下内容: <script type="text/javascript"> Sli

在使用Rmarkdown演示时,可以通过按
h
在每张幻灯片中选择。是否有办法使高亮显示模式在默认情况下处于启用状态,并通过按
h

禁用高亮显示模式默认情况下没有内置选项。
这来自以下几行JavaScript:and.
当扬声器更改幻灯片时,高亮显示模式将被删除

但是,默认情况下,有一种不常用的方法来突出显示每张幻灯片。
在项目中,创建一个新文件(例如命名为
highlight.html
)。
在此文件中,复制以下内容:

<script type="text/javascript">
  SlideDeck.prototype.prevSlide = function(opt_dontPush) {
    if (this.curSlide_ > 0) {
      var bodyClassList = document.body.classList;
      bodyClassList.add('highlight-code');

      // Toggle off speaker notes if they're showing when we move backwards on the
      // main slides. If we're the speaker notes popup, leave them up.
      if (this.controller && !this.controller.isPopup) {
        bodyClassList.remove('with-notes');
      } else if (!this.controller) {
        bodyClassList.remove('with-notes');
      }

      this.prevSlide_ = this.curSlide_--;

      this.updateSlides_(opt_dontPush);
    }
  };

  SlideDeck.prototype.nextSlide = function(opt_dontPush) {
    if (!document.body.classList.contains('overview') && this.buildNextItem_()) {
      return;
    }

    if (this.curSlide_ < this.slides.length - 1) {
      var bodyClassList = document.body.classList;
      bodyClassList.add('highlight-code');

      // Toggle off speaker notes if they're showing when we advanced on the main
      // slides. If we're the speaker notes popup, leave them up.
      if (this.controller && !this.controller.isPopup) {
        bodyClassList.remove('with-notes');
      } else if (!this.controller) {
        bodyClassList.remove('with-notes');
      }

      this.prevSlide_ = this.curSlide_++;

      this.updateSlides_(opt_dontPush);
    }
  };
</script>
它应该会起作用

---
title: "Highlighted"
author: "Romain Lesur"
date: "26/06/2018"
output: 
  ioslides_presentation:
    includes:
      after_body: highlight.html
---