The example below (i.e. saved as a file index.rmd ) has the same code chunk to display an image above and below the top level heading, but the image doesn't appear above the top level heading. This occurs if there is a file _output.yml with only this entry bookdown::gitbook: in the same directory.
That line seems to enforce a table of contents (which I want) and that appears to strip out anything (image or text) before the first top level heading by default (which I don't want) - so can this behaviour be modified?
---
site: bookdown::bookdown_site
---
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(imager)
im <- load.image(system.file('extdata/Leonardo_Birds.jpg',package='imager'))
plot(im, axes=FALSE)
```
# I'm a top level heading, but please let me have my image above! {-}
```{r echo=FALSE, message=FALSE, warning=FALSE}
library(imager)
im <- load.image(system.file('extdata/Leonardo_Birds.jpg',package='imager'))
plot(im, axes=FALSE)
```
From a post at rstudio community, I received the option of editing the _output.yml with
includes:
before_body: assets/big-image.html
includes is an option that will probably work, but it feels unnecessary - how about bookdown::gitbook: doesn't constrain the user to its ideal scenario of "nothing can exist above the top level header, therefore I will ignore anything that is there" :) - unless there is a really good reason I'm not aware of?
I have provided the necessary information about my issue.
If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
If I have posted the same issue elsewhere, I have also mentioned it in this issue.
I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered:
I've listed three approaches with their disadvantages as a stackoverflow answer. I'm fairly sure a neat resolution reguires a bookdown adjustment which is beyond my skill set. EDIT
There is now a workable hack at stackoverflow for html output. For pdf output, there are working examples of an image at the start here or pdf inserted at the start here
I'm going to close this issue unless someone else thinks it is important enough.
markbneal
changed the title
Allow images or text above first top level heading in bookdown::gitbook:
Allow images or text or pdf pages above first top level heading in bookdown::gitbook:
Mar 17, 2020
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.
The example below (i.e. saved as a file index.rmd ) has the same code chunk to display an image above and below the top level heading, but the image doesn't appear above the top level heading. This occurs if there is a file _output.yml with only this entry bookdown::gitbook: in the same directory.
That line seems to enforce a table of contents (which I want) and that appears to strip out anything (image or text) before the first top level heading by default (which I don't want) - so can this behaviour be modified?
From a post at rstudio community, I received the option of editing the
_output.ymlwithincludesis an option that will probably work, but it feels unnecessary - how aboutbookdown::gitbook:doesn't constrain the user to its ideal scenario of "nothing can exist above the top level header, therefore I will ignore anything that is there" :) - unless there is a really good reason I'm not aware of?Link to stackoverflow post:
Link to rstudio community post:
The
index.rmdand_output.ymlare in the following ziptestimage2.zip
By filing an issue to this repo, I promise that
xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/bookdown').I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: