-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
I'm developing a package that can insert author metadata in YAML header of Quarto files. I do this by rewriting YAML blocks using the following steps:
# extract YAML from file
yaml.load()
# add new data
as.yaml()
# insert YAML back into fileThe problem is that some information are lost in the process, including folded blocks:
lines <- "
bar: >
Lorem ipsum
Vivamus quis
"
yaml::yaml.load(lines) |>
yaml::as.yaml() |>
cat()
#> bar: |
#> Lorem ipsum Vivamus quisMy question is: is there any way to preserve folded blocks in that case? I'm not aware of a special type I can use to target the > with a handler.
I'm considering to insert author data in a separate YAML header when my insert function detects complex cases (e.g. the use of custom tags, repeated blocks, comments being dropped due to the libyaml dependency, etc.). I would prefer to do that on rare occasions though.
Metadata
Metadata
Assignees
Labels
No labels