Title: | 'Roxygen' to 'Markdown' |
Version: | 1.0.1 |
Date: | 2024-02-18 |
Description: | Converts elements of 'roxygen' documentation to 'markdown'. |
License: | GPL-3 |
URL: | https://roxygen2md.r-lib.org/, https://github.com/r-lib/roxygen2md |
BugReports: | https://github.com/r-lib/roxygen2md/issues |
Imports: | brio, cli, desc, devtools, rex, rlang, tibble, usethis |
Suggests: | rstudioapi, testthat (≥ 3.0.0) |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Config/testthat/edition: | 3 |
Config/Needs/website: | tidyverse/tidytemplate |
NeedsCompilation: | no |
Packaged: | 2024-02-18 17:50:08 UTC; kirill |
Author: | Kirill Müller [aut, cre], Heather Turner [ctb] |
Maintainer: | Kirill Müller <kirill@cynkra.com> |
Repository: | CRAN |
Date/Publication: | 2024-02-18 22:50:02 UTC |
roxygen2md: 'Roxygen' to 'Markdown'
Description
Converts elements of 'roxygen' documentation to 'markdown'.
Author(s)
Maintainer: Kirill Müller kirill@cynkra.com
Other contributors:
Heather Turner [contributor]
See Also
Useful links:
Report bugs at https://github.com/r-lib/roxygen2md/issues
Searches plain Rd in R source files
Description
Looks for Rd-like code in roxygen2 comments, especially useful after running
roxygen2md()
.
This function is designed for interactive use.
Usage
find_rd()
Value
A tidy data frame that has a print()
method
that also interacts with the RStudio API.
Examples
if (interactive()) {
# Show remaining Rd syntax after conversion.
find_rd()
}
Convert text to Markdown
Description
Converts a character vector from Rd to Markdown.
The scope
argument controls the depth of the transformation.
With scope = "none"
, no transformations are carried out.
The only effect is that Markdown is enabled for this package.
With scope = "simple"
, the following elements are converted:
-
\\code{}
-
\\emph{}
-
\\bold{}
and\\strong{}
-
\\href{}
-
\\url{}
With scope = "full"
, the following elements are converted in addition:
-
\\code{\link{}}
and\\link{}
, with[]
options -
\\linkS4class{}
With scope = "unlink"
, only the following elements are translated:
-
\\link{...}
to...
With scope = "indent"
, @param
and @return
tags spanning multiple lines
are indented with two spaces.
Usage
markdownify(text, scope = c("full", "simple", "unlink", "indent", "none"))
Arguments
text |
A character vector containing |
scope |
The scope of transformations: |
Value
The same vector with .Rd
style annotations converted to Markdown
style annotations.
Examples
text <- c(
"Both \\emph{italics} and \\bold{bold} text.",
paste0("We can also convert code: \\", "code{\\", "link{identity}}.")
)
text
markdownify(text)
Convert from Rd to Markdown in roxygen2 comments
Description
Performs various substitutions in all .R
files in a package
to make use of the Markdown functionality in roxygen2
.
This function is designed for interactive use, see markdownify()
for details
on the transformations.
Also attempts to enable Markdown support in roxygen2
by adding a field to
DESCRIPTION
.
Carefully examine the results after running this function!
Usage
roxygen2md(scope = c("full", "simple", "unlink", "indent", "none"))
Arguments
scope |
The scope of transformations: |
Value
List of changed files, invisibly
Examples
if (interactive()) {
# Convert roxygen to Markdown in one run
roxygen2md()
}
# Alternatively, convert in three steps:
if (interactive()) {
# 1. Enable Markdown processing
roxygen2md("none")
menu("Please examine/commit the changes and press 1 <enter> to continue.")
# 2. Convert simple markup
roxygen2md("simple")
menu("Please examine/commit the changes and press 1 <enter> to continue.")
# 3. (Optionally) Remove some of the \code{} expressions
roxygen2md("unlink")
menu(paste0(
"Please remove all unwanted changes, commit the wanted ones, ",
"and press 1 <enter> to continue."
))
# 4. Convert everything, including links
roxygen2md("full")
}