I would like to use child rmarkdown documents as "chapters" in my pagedown document and have the YAML options from that child document, such as title:
, be used as a first level section heading. Ideally all section headings in the child .Rmd would then be changed to one level lower.
I did my best to go through the extensive and wonderful documentation of bookdown and pagedown and rmarkdown but haven't been able to figure out how to accomplish this.
Parent Rmd:
---
title: Parent Title
output: pagedown::html_paged
---
# Parent First level header
Some text.
```{r, child='child.Rmd'}
Child Rmd:
---
title: Child Title
---
# Introduction
Some child text.
Desired Result:
---
title: Parent Title
output: pagedown::html_paged
---
# Parent First level header
Some text.
# Child Title
## Introduction
Some Child text.
From https://bookdown.org/yihui/bookdown/usage.html:
Each R Markdown file must start immediately with the chapter title using the first-level heading, e.g., # Chapter Title.
You might be able to hack the code to work as desired, but it would seem easier just to add your chapter titles as first-level headings, and then just increase all subsequent section headings by one level...for example with find/replace on the regexp (^#+)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With