bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

gitbook chapters not rendered if split_by not specified in _output.yml

Open vickyscowcroft opened this issue 4 years ago • 4 comments

Hello,

We've come across an issue since upgrading to bookdown 0.24 that we weren't seeing in 0.22. Previously we weren't using the 'split_by' option in _output.yml and bookdown was correctly rendering the gitbook and including all the Rmd files as individual chapters. In 0.24 when we don't specify 'split_by: rmd' only index.html and 404.html are created in the _book output folder and all the html chapter files are missing. However, the individual Rmd files are picked up when creating the toc - all the chapter/section names appear in the toc on the left hand side of the screen, but the links don't work.

Adding 'split_by: rmd' works in both bookdown 0.22 and 0.24 so we're able to build the same document on computers that haven't been updated yet.

This doesn't affect the pdf_book output - that picks up all the chapters fine without any changes to _output.yml

vickyscowcroft avatar Sep 29 '21 15:09 vickyscowcroft

Hi @vickyscowcroft !

Thanks for the repot. I'll look into this to try to reproduce.

Can you share more on your YAML content ? Which format are you using ? I assume gitbook()

Any information that can help me reproduce this will be helpful.

cderv avatar Sep 29 '21 16:09 cderv

I also need more information because split_by = "chapter" by default in gitbook(). So if you weren't providing this configuration before, then this value was used. Now you are saying that split_by = "rmd" is used, so it would lead to different result.

If you can share with me an example with the behavior described happening, that would help me a lot (like a Github repo I can clone or a zip file with a project in it).

I'll try to reproduce using

  • Using bookdown-demo and / or the template project
  • bookdown 0.24
  • no split_by option provided - so using default value

If the issue arises because of specific content from your project I'll need more informations.

Thank you !

cderv avatar Sep 29 '21 16:09 cderv

Hi,

Here's a copy of the _output.yml

bookdown::gitbook:
  toc_depth: 2
  css: style.css
  config:
    toc:
      collapse: section
      before: |
        <li><a href="./">PH20105 Booklet</a></li>
      after: |
        <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    # edit: https://github.com/rstudio/bookdown-demo/edit/master/%s
  split_bib: FALSE
  split_by: rmd

bookdown::pdf_book:
  includes:
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

I haven't tested it with split_by: chapter but will test that later today. When I run it on the machine with 0.22 installed I don't need to provide anything for split_by - it works as expected and splits by chapter.

I'll check with my colleague that they're happy for me to upload the project - it's teaching material so I need to be a little careful.

vickyscowcroft avatar Sep 30 '21 09:09 vickyscowcroft

Thank that is helpful !

I'll try to reproduce like this. You could also fork bookdown-demo (https://github.com/rstudio/bookdown-demo) and see if you can reproduce.

When I run it on the machine with 0.22 installed I don't need to provide anything for split_by

This should mean that splitting happens by chapter

I'll see if I can spot a difference between both versions.

cderv avatar Sep 30 '21 09:09 cderv