I've created several vignettes for a package, with figures I want to reference in the text.
Using the template for a .Rmd
vignette, I can do this by using bookdown::html_document2
as follows in my yaml header:
output:
bookdown::html_document2:
base_format: rmarkdown::html_vignette
fig_caption: yes
toc: true
Yet, when I build the associated pkgdown
site, I don't get figure numbers or cross-references,
done with \@ref(fig:chunk_name)
.
Is there some magic I can add to my _pkgdown.yml
file to have it use the bookdown output format?
Edit: Not sure if this has anything to do with this issue, but my figure chunk labels are of the form topic-figure
rather than topic_figure
.
E.g.,
```{r, plastic1-HE3D}
#| echo=FALSE,
#| fig.cap="3D HE plot for the plastic MLM"
knitr::include_graphics("fig/plastic-HE3D.png")
```
A solution that seems to work is suggested in https://github.com/r-lib/pkgdown/issues/2201
Essentially, add pkgdown: as_is: true
to the yaml headers of vitnettes:
output:
bookdown::html_document2:
base_format: rmarkdown::html_vignette
fig_caption: yes
toc: true
toc_depth: 2
pkgdown:
as_is: true
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