insightsengineering / teal.modules.general

General Purpose Teal Modules
https://insightsengineering.github.io/teal.modules.general/
Other
9 stars 13 forks source link

[Docs] Update `ggplot2_args` roxygen2 template or integrate with `shared_params` #695

Open averissimo opened 7 months ago

averissimo commented 7 months ago

@kartikeyakirar found an interesting thing on the documentation about the @template tag

Q: Should we keep using the @template tag? (it has been superseded) _take a look at man-roxygen/ggplot2_args_multi.R and search for ggplot_2_args_multi_

If we stop using it, we can add this parameter to the shared_params definition and add the custom information to @details

Context

{tmg} is using the @template roxygen tag to add a "customizable" parameter ggplot2_args.

This template allows a special <%=ggnames%> string that defines a placeholder for a ggnames variable and, thus, has a custom documentation for each time it's used. (to supply different allowable values)

This tag has been superseded by {roxygen2} in favour of inline code.

Definition of Done

averissimo commented 7 months ago

I don't see an immediate need to remove this tag as long as it's not deprecated. It seems useful and removes duplicated code.

gogonzo commented 7 months ago

If we stop using it, we can add this parameter to the shared_params definition and add the custom information to @details

Do you think we can move it to shared_params with a dynamic list of ggnames somehow? When it is in shared_params then it is constant for all inheriting documents. Do you mean that some content can be share in shared_params and some can be separately included in each @details

averissimo commented 7 months ago

Do you think we can move it to shared_params with a dynamic list of ggnames somehow?

AFAIK from reading the documentation it's not possible, but if it is, then that would be the best solution

Do you mean that some content can be shared in shared_params and some can be separately included in each @details

Yes, either in the details or in a separate section.

#' inheritParams shared_params
#' ...
#' @details
#' #### `ggplot2_args`
#' List names for `ggplot2_args` should match the following: `c("default", "A", "B", "C")`.
#'
#' For more details see the vignette: `vignette("custom-ggplot2-arguments", package = "teal.widgets")`.

image