Options in _site.yml are overwriting individual .rmd YAML options
When building a website with rmarkdown, in earlier versions (< 0.9.6), I used to have these options in my _site.yml:
name: "my-website"
output_dir: "."
output:
html_document:
toc: true
toc_depth: 4
toc_float:
collapsed: false
smooth_scroll: false
mainly to specify that I wanted a toc in all pages. However, there are some pages that I don't want a toc, so, in the YAML header of such pages I had something like:
---
title: "About This Website"
output:
html_document:
toc: false
---
In earlier versions of rmarkdown, this used to work fine, and pages with this header did not have a toc. Since version 0.9.6 (and one before that, AFAIR), these exact same configuration are not working anymore, ie, all pages are rendering with a toc, even those with the YAML header above.
I didn't change any configuration, only updated rmarkdown, and that stopped working. So now, _site.yml options are overwriting individual pages options (at least with toc configurations). Is that a desired behavior? If so, what should I change to prevent some pages of rendering a toc?
A fully reproducible example is available here: https://github.com/fernandomayer/rmd-test
Thanks.
The issue is this change here:
https://github.com/rstudio/rmarkdown/commit/4acf3d160fd95b24a6bfdc8ca1185ed5851089f0
toc_float is forcing toc: true so you also need to set toc_float to FALSE in your individual pages where you want no table of contents.
On Mon, May 2, 2016 at 7:47 PM Fernando Mayer [email protected] wrote:
When building a website with rmarkdown, in earlier versions (< 0.9.6), I used to have these options in my _site.yml:
name: "my-website" output_dir: "." output: html_document: toc: true toc_depth: 4 toc_float: collapsed: false smooth_scroll: false
mainly to specify that I wanted a toc in all pages. However, there are some pages that I don't want a toc, so, in the YAML header of such pages I had something like:
title: "About This Website" output: html_document:
toc: false
In earlier versions of rmarkdown, this used to work fine, and pages with this header did not have a toc. Since version 0.9.6 (and one before that, AFAIR), these exact same configuration are not working anymore, ie, all pages are rendering with a toc, even those with the YAML header above.
I didn't change any configuration, only updated rmarkdown, and that stopped working. So now, _site.yml options are overwriting individual pages options (at least with toc configurations). Is that a desired behavior? If so, what should I change to prevent some pages of rendering a toc?
A fully reproducible example is available here: https://github.com/fernandomayer/rmd-test
Thanks.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/rstudio/rmarkdown/issues/689
Thanks @jjallaire.
Setting toc_float: false now did the trick.
Cheers.
I changed my mind on this (as I think you won't be the only one who is confused by this behavior) and reverted the automatic setting of toc = TRUE in the presence of toc_float settings here: https://github.com/rstudio/rmarkdown/commit/450360fc2a0c0b498a9313e4bd4252616a572c1a
Thanks, that makes much more sense, IMHO.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.