0

I'm not sure if bookdown supports what I'm looking for as I am unable to find out how to do it. I would like to create a gitbook format as a standalone html file, but I want each chapter/section to be it's own page rather than it creating one very long page.

Take the following code:

---
title: "A Book"
author: "nook"
documentclass: krantz
output:
  bookdown::gitbook:
    split_by: none
    self_contained: true
    keep_md: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Hello World

Hi.

Bye.

# Hello World 2

Hi.

Bye.
Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75
tempy temper
  • 101
  • 1

1 Answers1

0

Welcome to stackoverflow!

This is specified by the argument split_by in the YAML header of the document which you have set to none: split_by: none results in a single HTML file. In order to split the document by Chapter (first-level headings, i.e, lines starting with a #) you have to set split_by: chapter. So the document header should look like this:

---
title: "A Book"
author: "nook"
documentclass: krantz
output:
  bookdown::gitbook:
    split_by: chapter
    self_contained: true
    keep_md: true
---

See the documentation of the bookdown package for further options.

Martin C. Arnold
  • 9,483
  • 1
  • 14
  • 22