knitr icon indicating copy to clipboard operation
knitr copied to clipboard

Improve `convert_chunk_header()`

Open cderv opened this issue 2 years ago • 3 comments

This knitr::convert_chunk_header("rapport/pingouins.Rmd", "rapport/pingouins.qmd") should use YAML chunk option in output

  • [x] when using with type: yaml or with .qmd extension, . in options should be replaced with -.
    knitr::convert_chunk_header("rapport/pingouins.qmd", output = identity) should have fig-width and not fig.with (closed by https://github.com/yihui/knitr/pull/2300)

cderv avatar Jun 06 '23 15:06 cderv

What about making sure option are converted from echo = FALSE to #| echo: false ?

Currently : echo = FALSE will yield #| echo = FALSE My humble expectation : echo = FALSE will yield #| echo : false and be fully quarto compliant

ALanguillaume avatar Jul 20 '23 13:07 ALanguillaume

My bad knitr::convert_chunk_header("foo.Rmd", output = "foo.qmd", type = "yaml") solves my problem. Apologies !

ALanguillaume avatar Jul 20 '23 13:07 ALanguillaume

You indeed need to use type = "yaml" as it is not the default unless you are converting from a .qmd

knitr::convert_chunk_header("foo.qmd", output = identity)

So you can copy and rename you Rmd file and then convert.

We did that because for Rmd files the YAML syntax is not the prefered multiline syntax. https://yihui.org/en/2022/01/knitr-news/#an-alternative-syntax-for-chunk-options

cderv avatar Jul 20 '23 15:07 cderv