For bookdown the width of a code block should be 770px not the 910px it currently is. We can check the document type using rmarkdown::metadata. For a normal Rmd document, this will return something like
$ouput
[1] "html_document"
but for a bookdown project, it will return something similar to
$title
[1] “A Minimal Book Example”
$author
[1] “Yihui Xie”
$date
[1] “r Sys.Date()”
$site
[1] “bookdown::bookdown_site”
$documentclass
[1] “book”
$link-citations
[1] TRUE
$description
[1] “This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook.”
So we can target output for Rmd documents and documentclass or site for bookdown.
For bookdown the width of a code block should be
770px
not the910px
it currently is. We can check the document type usingrmarkdown::metadata
. For a normal Rmd document, this will return something likebut for a bookdown project, it will return something similar to
So we can target
output
for Rmd documents anddocumentclass
orsite
for bookdown.