-
Notifications
You must be signed in to change notification settings - Fork 235
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
merge multiple different types of @describeIn in one minidesc #1182
Conversation
so far, just added a failing test to document that this is being worked on. |
this now broadly works (I think), but see above todos. |
I probably won't have the time to work on this during the current release window (@hadley mentioned around April 22, 2022 as a target release). The remaining todos are:
Before I do these, I will wait for some feedback on this PR, whether:
|
I've only done a fairly quick skim but I think overall the aims and the implementation are good. There's small stuff that could be improved, but the overall "shape" seems looks good to me. |
Conflicts: R/rd-describe-in.R vignettes/rd.Rmd
And drop brio dep
* Use sentence case for headings * Alphabetise subsections * More than one bullet per list
And minor tweaks to docs
Always use full names
@maxheld83 would you mind taking a look through the snapshot tests to make sure that I've stayed roughly true to your original vision? I changed the subsections to sections (since I think most functions will only have one, and it will appear more prominent in (e.g.) the pkgdown documentation), and I always display the full function name (since I that seemed less confusing to me). |
Adjust order so related functions come last
Fixes #1370 |
absolutely ☑️
Agreed this makes more sense / looks cleaner. |
🙏 thank you so much for taking this on @hadley and bringing it to completion! |
This PR extends
@describeIn
to allow the documentation of both methods and (other) functions in a minidesc.This closes #1181.
It goes further than the original issue: rather than extending the fallback behavior (everthing treated as a function), this now creates subsections for the separate types of functions.
I think this is quite helpful, such as when documenting together a class constructor (as the destination), some methods and some helpers (normal functions).
For a real-use case, see our doi functions.
This PR makes a couple of user-facing changes:
It should not be possible to get more than 2 subheadings though.
(I think the "by class"/"by generic" language alone could be a little hard to wrap your head around).
And some internal changes:
type = c("generic", "class")
, the data structure now records whether a given source function extends the destination function.To be precise,
extends
records wether a source method actually corresponds to the generic or constructor in the destination.Labels and subheadings are then generated from this information in the formatting functions.
A couple of things remain to be done before this is ready for review:
Typical case: constructor is called
class()
, but class is calledpkg_class()
as recommended.stringsAsFactors
😾)The remaining build fails (
Ubuntu-16.04 3.2
,macOS-latest (devel)
) appear to be unrelated, intermittent and/or stemming from missing dependencies.Then, once in review (if I even get that far) I have some comments / questions:
the example roxygen2 blocks are programmatically reused between tests and vignette.This does not seem to be recommended in r-lib/tidyverse as per offer idiom to reuse fixture / setup code in vignettes, examples, docs testthat#1308, because it makes the
test-*.R
files harder to read.However, in this case, the pattern is already used with several
tests/testthat/roxygen-block-*.R
, so perhaps it's ok?If not, I'll re-duplicate these, if the rest is OKed.
(Re-duplication is required).
I've added brio toDESCRIPTION
, though I think it already comes via testthat, so it should not bloat the actual dependency graph.Happy to add it.
This could be changed easily; my rationale was that it might be confusing for users if the structure changes depending on the content.
But the two levels of headings do take up a fair bit of space, which isn't great.