Title: | Markdown Reference Manuals |
---|---|
Description: | Native R only allows PDF exports of reference manuals. The 'Rd2md' package converts the package documentation files into markdown files and combines them into a markdown version of the package reference manual. |
Authors: | Julian Busch [aut, cre] |
Maintainer: | Julian Busch <[email protected]> |
License: | GPL |
Version: | 1.0.1 |
Built: | 2025-02-12 04:11:25 UTC |
Source: | https://github.com/quantsch/rd2md |
Functions to parse and convert Rd files to markdown format reference manual.
Julian Busch [email protected]
knitr
S3 Methods to parse different classes into Markdown.
as_markdown(x, ...)
as_markdown(x, ...)
x |
Object |
... |
Further arguments passed to methods |
Specifies markdown output format parameters.
md_document( file_ext = ".md", section_level = 1, date_format = "%F", toc = FALSE )
md_document( file_ext = ".md", section_level = 1, date_format = "%F", toc = FALSE )
file_ext |
File extension, if default output_file name |
section_level |
Initial section level, subsection level |
date_format |
See |
toc |
Currently not implemented. If table of contents should be included in reference manual. |
Specifies output format parameters.
output_format(output_class_suffix, file_ext, parse_fun, ...)
output_format(output_class_suffix, file_ext, parse_fun, ...)
output_class_suffix |
Suffix to class name. E.g. |
file_ext |
File extension, if default output_file name. |
parse_fun |
Parsing function, should be a generic S3 method. |
... |
Named arguments inserted into list structure output and eventually
passed as arguments to |
Note that this will always end in one newline \n.
rd_str_to_md(x, fragment = TRUE, ...)
rd_str_to_md(x, fragment = TRUE, ...)
x |
Rd string. Backslashes must be double-escaped ("\\"). |
fragment |
logical indicating whether this represents a complete Rd file |
... |
additional arguments for as_markdown |
rd_str_to_md("a\n%b\nc") rd_str_to_md("a & b") rd_str_to_md("\\strong{\\emph{x}}") rd_str_to_md("\\enumerate{\\item test 1\n\n\\item test 2}") rd_str_to_md("wrapped \\itemize{\\item test 1\n\\item test 2} in text")
rd_str_to_md("a\n%b\nc") rd_str_to_md("a & b") rd_str_to_md("\\strong{\\emph{x}}") rd_str_to_md("\\enumerate{\\item test 1\n\n\\item test 2}") rd_str_to_md("wrapped \\itemize{\\item test 1\n\\item test 2} in text")
And return object of class rdfile
read_rdfile(path, subclass = NULL)
read_rdfile(path, subclass = NULL)
path |
File path of |
subclass |
Potential subclass of returned |
This is a wrapper to combine the Rd files of a package source or binary into a reference manual in markdown format.
render_refman(pkg = getwd(), output_file = NULL, output_format = md_document())
render_refman(pkg = getwd(), output_file = NULL, output_format = md_document())
pkg |
Full path to package directory.
Default value is the current working directory.
Alternatively, a package name can be passed as string.
If this is the case, |
output_file |
Specify outputfile, including file extension |
output_format |
Output format function. See |
Murdoch, D. (2010). Parsing Rd files
Package Rd2markdown, on which the original version was based on.
Package pkgdown, on which the current (refactored) version is based on.
## give source directory of your package pkg_dir = "~/git/MyPackage" ## create reference manual ## render_refman(pkg_dir)
## give source directory of your package pkg_dir = "~/git/MyPackage" ## create reference manual ## render_refman(pkg_dir)