rd2markdown | R Documentation |
Render a Rd object out to a markdown file
LIST
Rd tags are produced with an unnamed infotex function call. Whereas
normal infotex syntax follows a \name{arg}
convention, naked
{arg}
will be captured as a LIST
. This syntax has been adopted as a
convention for package names. The desired rendering of this element is often
ambiguous. To try to accommodate as many cases as possible, it is rendered as
plain text.
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'Rd'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'list'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class ''NULL''
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'AsIs'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'name'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'alias'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'keyword'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'concept'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'USERMACRO'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'code'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'RCODE'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'verb'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'pkg'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'env'
rd2markdown(x, fragments = c(), ...)
## Default S3 method:
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'title'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'description'
rd2markdown(x, fragments = c(), ..., title = "Description", level = 1L)
## S3 method for class 'author'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'format'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'details'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'note'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'source'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'value'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'section'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'subsection'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'examples'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'usage'
rd2markdown(..., level = 1L)
## S3 method for class 'preformatted'
rd2markdown(x, fragments = c(), ..., title = NULL, language = "", level = 1L)
## S3 method for class 'references'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'seealso'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'arguments'
rd2markdown(x, fragments = c(), ..., level = 1L)
## S3 method for class 'dots'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'TEXT'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'COMMENT'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'character'
rd2markdown(
x = NULL,
fragments = c(),
...,
topic = NULL,
package = NULL,
file = NULL,
macros = NULL,
envir = parent.frame()
)
## S3 method for class 'emph'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'item'
rd2markdown(x, fragments = c(), ..., item_style = "**")
## S3 method for class 'enumerate'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'itemize'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'describe'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'LIST'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'tabular'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'tab'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'cr'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'href'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'url'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'eqn'
rd2markdown(x, fragments = c(), ...)
## S3 method for class 'deqn'
rd2markdown(x, fragments = c(), ...)
x |
An Rd object, list, help topic or Rd tag to convert into markdown-formatted help. |
fragments |
An optional vector of fragment tag names (such as "description", "details" or "title") to filter the Rd object tags. |
... |
Additional arguments used by specific methods. |
level |
Level (number of #') of the root section (title). Defaults to 1L |
title |
optional section title |
language |
language to use as code fence syntax highlighter |
topic |
usually, a name or character string specifying the topic for which help is sought. A character string (enclosed in explicit single or double quotes) is always taken as naming a topic. If the value of See ‘Details’ for what happens if this is omitted. |
package |
a name or character vector giving the packages to look
into for documentation, or |
file |
Alternatively, provide a |
macros |
Filename or environment from which to load additional macros, or a logical value. See the Details below. |
envir |
An optional environment in which to search for the help topic |
item_style |
Used for two-part |
rd2markdown is the core function of the package. can work in various types.
It accepts .Rd objects extracted with get_rd
option but also can directly fetch documentation topics based on the file
path or the package. Due to the design, it follows, rd2markdown
function has high flexibility. It is worth pointing out that the actual
output of rd2markdown
function is a character vector of length one
that uses special signs to format the document. Use
writeLines
function to create an actual markdown file
using this output. The rd2markdown
function parses documentation
object based on an innovative idea of treating each .Rd tag as a separate
class and implementing methods for those classes. Thanks to that the package
is easily extensible and clear to understand. To see the list of currently
supported tags please see the Usage section.
get_rd
documentation_to_markdown
# Using get_rd
rd_file_example <- system.file("examples", "rd_file_sample.Rd", package = "rd2markdown")
rd <- rd2markdown::get_rd(file = rd_file_example)
cat(rd2markdown::rd2markdown(rd))
# Limit to particular sections
rd <- rd2markdown::get_rd(file = rd_file_example)
cat(rd2markdown::rd2markdown(rd, fragments = c("description", "usage")))
# Use file parameter
cat(rd2markdown::rd2markdown(file = rd_file_example))
# Use topic and package parameters
cat(
rd2markdown::rd2markdown(
topic = "rnorm",
package = "stats",
fragments = c("description", "usage")
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.