-
Notifications
You must be signed in to change notification settings - Fork 73
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
Style for examples in roxygen or .Rd files #332
Comments
Thanks @nfultz, sounds like a cool idea but probably that's not straight forward if it should be done in a safe and clean way. We'd probably have to
Indeed this seems really similar to #13 and I think for consistency, the infrastructure introduced in #233 should be re-uesd / extended as much as possible so that we can avoid code duplication. Any interest to get us started with a PR? If yes, please make sure to follow the contribution guide lines outlined here. I am happy to review. Otherwise, this will be postponed at least a few months due to time constraints. |
Anyways I think we should limit our attention to roxygen source code in a first step if that's ok for you since the majority of package developers uses roxygen. |
Another idea - there is all ready existing tools to go from So the missing link could be from an examples .R => Rd, which would give a round trip of: ugly roxygen => ugly Rd => ugly package-Ex.R => styler package-Ex.R => pretty Rd => pretty roxygen styler would just need to be "compatible" with the tool chain and maintain the example metadata already present in You might imagine a similar flow for R markdown, by going through |
Ok. I think it's cleaner if we can style the source code directly instead of a derivative of it. Also, the mapping from pretty .Rd back to the source file line where the example stems from seems to make things complicated IMHO. What do you think? Did you take a look at #233? Instead of separating out code / non code from an Rmd and styling this, we want to separate |
Rumours has it that @jonmcalder will take a stab on that issue sometime soon... |
Borderline related: I sometimes wish there was a tool that adds indention for the second, third, ... lines of |
I created stylermd a few months ago to make markdown text 80 characters long, maybe that fits there. |
But this seems to be for |
Yes maybe, but it's not a top priority for me now. |
It seems as we finally managed to implement this. Anyone interested in testing? I tested on styler and ggplot2 source code and I did not get any unexpected problems. You can install the version from the corresponding branch of #381. remotes::install_github("r-lib/styler#381") Any feedback welcome. All top-level APIs gain an argument |
It would be cool if we could also restyle the examples in our R package, since that's code that end users might actually see.
The text was updated successfully, but these errors were encountered: