Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding default knitr chunk options #1390

Merged
merged 17 commits into from
Jul 11, 2022
Merged

Conversation

gaborcsardi
Copy link
Member

@gaborcsardi gaborcsardi commented Jul 10, 2022

I think this would be useful to avoid repetition. I can try to write some test case.

Potentially fixes #1240

@gaborcsardi gaborcsardi requested a review from hadley July 10, 2022 07:43
@hadley
Copy link
Member

hadley commented Jul 10, 2022

What about reading from knitr::opts_chunk$get() so we could avoid having to maintain the state ourselves?

What do you think the scope should be for the options? A single .Rd or the whole package?

@gaborcsardi
Copy link
Member Author

IDK, it just seems simpler to specify the defaults in the config, and then use them in the whole package.

So I think the scope should be the whole package, for simplicity.

@hadley
Copy link
Member

hadley commented Jul 10, 2022

Yeah, that makes sense. Can you also add a few words to the rd-formatting.Rmd vignette in the code chunks section?

@hadley hadley added this to the 7.2.1 milestone Jul 10, 2022
@gaborcsardi
Copy link
Member Author

@hadley all done, I believe.

We need to run the test in a subprocess, unfortunately, because it messed up the roxygen pptions we rely on in other test cases. Alternatively we could add a knitr_chunk_options option to roxygen2 itself, maybe that's better?

@hadley
Copy link
Member

hadley commented Jul 10, 2022

Maybe we should have a local_roxy_meta_set()? Then I think you could just roc_proc_text() instead of having to set up a separate package?

@hadley hadley merged commit 5aa318a into main Jul 11, 2022
@hadley hadley deleted the feature/knitr-chunk-options2 branch July 11, 2022 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Having a way to set knitr chunk options for code chunks would be nice
2 participants