打印rmarkdown网站时删除toc

时间:2017-09-11 17:45:54

标签: css r-markdown

我使用超级多功能Rmarkdown软件包创建了一个使用R提取和修改的site for a set of seminars

_site.yml文件看起来像这样

name: "Seminars at Biostatistics, UCPH"
exclude: ["*.Rmd*", "*.json", "Makefile"]
navbar:
  title: "Seminars @ Biostatistics, UCPH"
  left:
    - text: "Upcoming seminars"
      icon: fa-lightbulb-o
      href: index.html
    - text: "Previous seminars"
      icon: fa-calendar
      href: previous.html      
  right:
    - icon: fa-question fa-lg
      href: http://biostat.ku.dk
output:
  html_document:
    theme: readable
    highlight: textmate
    include:
      after_body: footer.html
    toc: true
    toc_float: true
    css: style.css

当页面打印在纸上时,内容表与主文本重叠,这使得它变得无用。

打印时是否可以删除toc?直接通过yaml中的参数或可能通过css和@media命令

1 个答案:

答案 0 :(得分:1)

当然。在样式表中:

@media print {

  #TOC { display: none; }

}