r-lib / hugodown

Make websites with hugo and RMarkdown
https://hugodown.r-lib.org
Other
166 stars 24 forks source link

Preserving authors as a vector? #18

Closed maelle closed 4 years ago

maelle commented 4 years ago

At the moment knitting my Rmd that has

authors:
  - Maëlle Salmon

gives

authors: Maëlle Salmon

I'd understand your closing this since I should make the theme robust to this change

hadley commented 4 years ago

No, this is a buglet with my yaml roundtripping that I don't know how to work around yet.

maelle commented 4 years ago

do you need the roundtripping only for adding the hash? I was thinking of a non elegant solution, replacing

---

with

hash blabla
---

using regex (with another case when the hash exists). rmarkdown uses regex to identify the YAML.

maelle commented 4 years ago

Thanks to this issue I'm realizing tinkr (commonmark and xlst instead of pandoc) probably doesn't handle the YAML roundtripping much better. :upside_down_face:

hadley commented 4 years ago

@maelle yeah, that's what I was thinking about doing

cderv commented 4 years ago

I wondered the same for this yaml preservation.

Just in case you don't know, there is currently an internal rmarkdown fonction to extract yaml without parsing it : partition_yaml_front_matter

It is used to preserve the yaml in md_document format, and internally in yaml_front_matter. Exporting this function could be a solution maybe if you want to reduce rewritten function. extract_yaml is simple enough though so maybe it does not worth the trouble...

hadley commented 4 years ago

Yeah I read the source to that and extracted the bit I thought was sufficient.