Put quoted inline R function in your blogdown or quarto post's YAML header to
have the packages be the packages used in your post (wrapper around
funspotr::spot_pkgs()
).
Usage
spot_tags(
file_path = knitr::current_input(),
used = FALSE,
drop_knitr = FALSE,
yaml_bullet = NULL,
...
)
Arguments
- file_path
Default is the file being knitted but can change to some other file (e.g. in cases where the code for the post may reside in a different file).
- used
Default is
FALSE
. IfTRUE
will pass toshow_pkgs_used()
rather thanshow_pkgs()
. (Mainly useful for showing actual packages used rather than meta-packages being called liketidyverse
ortidymodels
. Also uses a more strict parsing method.- drop_knitr
Many blogdown posts have
knitr::opts_chunk$set()
in them and you may not want this tag showing-up. Default is to keep this, but set toFALSE
to drop "knitr" from being tagged.- yaml_bullet
Default is
NULL
meaning thatfile_path
is read-in and correct format is guessed based on "spot_tags" appearance with either a hyphen or bracket (corresponding with bulleted or array format in the YAML header).If it's first occurrence happens on a line that contains a bracket the value becomes
FALSE
else it becomesTRUE
. If set toNULL
and "spot_tags" is not detected at all infile_path
it will default toFALSE
.yaml_bullet
can also be specified directly with eitherTRUE
orFALSE
.TRUE
entails thatspot_tags()
is set in a YAML bullet,FALSE
indicates the user is inputting it in an array (see examples below).See examples for how to hard-code.
- ...
Any additional arguments to pass to
spot_pkgs*()
.
Value
Character vector in a format meant to be read while evaluating the YAML header when rendering.
Details
:
tags- "`r funspotr::spot_tags()`"
OR
: ["`r funspotr::spot_tags()`"] tags
OR
: ["`r funspotr::spot_tags()`"] categories
Thanks Yihui for the suggestions and for getting this working blogdown#647, blogdown#693.)