Make proper Rmd/Qmd chunk labels from strings for parsermd::parse_rmd()

chunk_labels(x)

Arguments

x

A character string of chunk labels to convert

Value

A character string of the same length as x with "educated" labels.

Examples

chunk_labels(c("Summer is hot", "", NA, " ", "Winter is cold  "))
#> [1] "Summer_is_hot"  ""               NA               " "             
#> [5] "Winter_is_cold"