Title: | 'Roxygen' to 'Markdown' |
---|---|
Description: | Converts elements of 'roxygen' documentation to 'markdown'. |
Authors: | Kirill Müller [aut, cre], Heather Turner [ctb] |
Maintainer: | Kirill Müller <[email protected]> |
License: | GPL-3 |
Version: | 1.0.1.9006 |
Built: | 2024-11-22 03:03:08 UTC |
Source: | https://github.com/r-lib/roxygen2md |
Looks for Rd-like code in roxygen2 comments, especially useful after running
roxygen2md()
.
This function is designed for interactive use.
find_rd()
find_rd()
A tidy data frame that has a print()
method
that also interacts with the RStudio API.
if (interactive()) { # Show remaining Rd syntax after conversion. find_rd() }
if (interactive()) { # Show remaining Rd syntax after conversion. find_rd() }
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.
markdownify(text, scope = c("full", "simple", "unlink", "indent", "none"))
markdownify(text, scope = c("full", "simple", "unlink", "indent", "none"))
text |
A character vector containing |
scope |
The scope of transformations: |
The same vector with .Rd
style annotations converted to Markdown
style annotations.
text <- c( "Both \\emph{italics} and \\bold{bold} text.", paste0("We can also convert code: \\", "code{\\", "link{identity}}.") ) text markdownify(text)
text <- c( "Both \\emph{italics} and \\bold{bold} text.", paste0("We can also convert code: \\", "code{\\", "link{identity}}.") ) text markdownify(text)
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!
roxygen2md(scope = c("full", "simple", "unlink", "indent", "none"))
roxygen2md(scope = c("full", "simple", "unlink", "indent", "none"))
scope |
The scope of transformations: |
List of changed files, invisibly
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") }
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") }