qmd <- tempfile(fileext = ".qmd")
writeLines(c(
"Species evolve by natural selection [@Darwin1859]; see @fig-map.",
"```{r}",
"x@slot # not a citation",
"```"
), qmd)
cz_qmd_keys(qmd)[1] "Darwin1859"
Strips fenced code blocks first (so @ in R code is never mistaken for a citation), finds @key tokens, then drops Quarto cross-references (?@fig-x, ?@tbl-x, ?@eq-x, …), which use the same syntax but are not bibliography citations.
| Arguments | Description |
|---|---|
| path | Path to a .qmd or .Rmd file. |
| crossref_prefixes | Cross-reference prefixes to drop (without the trailing hyphen). |
Sorted character vector of unique citation keys (no leading @).