Roxygen templates are .R
files that live in the man-roxygen
directory in the root of a package.
They are inserted verbatim into a Roxygen block via @template templatename
(for example, man-roxygen/con.R
would be inserted by @template con
).
For a basic example, see the template file man-roxygen/con-generic.R
, the target R file R/query-general.R
, and the resulting Rd file man/generic_query.Rd
.
Templates can be modified pro by via the brew templating system, which can execute arbitrary R code to produce the desired output.
This is especially powerful when combined with variables, which can be set with @templateVar variable value
.
For an example, see the template file man-roxygen/con-specific.R
, the target R file R/query-specific.R
, and the resulting Rd files man/postgres_query.Rd
and man/sqlite_query.Rd
.
See the brew
package manual for more details on template syntax.
Some examples of this in the wild:
netdiffuseR
package: template file, R function, and resulting Rd file.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.