bookdown doesn't compile custom blocks in child rmd

Bookdown doesn't seem to recognize custom blocks that are defined in a child .Rmd document.

For example, if I modify the 01-intro.Rmd from the bookdown template, and add a custom block like below, then everything works as expected and a new div wrapper is added to the html etc.


```{block, type='FOO'}
some text
```

However, if I create a child .Rmd document, and add that to 01-intro.Rmd, like this:


```{r child="childdoc/testchild.Rmd", echo=FALSE}
```

And, if the child document contains a custom block, say like this:


```{block, type='FOO'}
some text
```

Then, when I build the book, the custom block from the child .Rmd is not inserted into the html as a div or to latex as an environment.

Is this a known issue? Or, what do I need to do to allow custom blocks in a child .Rmd?

Thanks for any help

Found one workaround, which is to print the child to the parent. Including the following in the parent document 01-intro.Rmd, instead of the above method of including the child document seems to allow the custom blocks in the child to be compiled correctly.

 ```{r, echo=FALSE}
 knitr::asis_output(knitr::knit_child("childdoc/testchild.Rmd", quiet=TRUE))
 ```

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.