pkg2HTML {tools}R Documentation

Rd Converters


Generate a single-page HTML reference manual from the Rd sources contained in an installed or source R package.


pkg2HTML(package, dir = NULL, lib.loc = NULL,
         outputEncoding = "UTF-8",
         stylesheet = file.path(R.home("doc"), "html", "R-nav.css"),
         hooks = list(pkg_href = function(pkg) sprintf("%s.html", pkg)),
         texmath = getOption("help.htmlmath"),
         prism = TRUE,
         out = NULL,
         toc_entry = c("title", "name"),
         Rhtml = FALSE,
         mathjax_config = file.path(R.home("doc"), "html", "mathjax-config.js"),
         include_description = TRUE)



a character string, typically giving the name of an installed package. Can also be a file path or URL pointing to a source tarball (this feature is experimental).


character string giving the path to a directory containing an installed or source package.


a character vector describing the location of R library trees to search through, or NULL. Passed on to find.package and Rd_db.


character string; see Rd2HTML.


character string giving URL containing CSS style information.


A list of functions controlling details of output. Currently the only component used is pkg_href, which is used to determine the output HTML file path given a package name as input.


character string controlling math rendering library to be used, either "katex" or "mathjax". The default is to use "katex", unless the package appears to use the mathjaxr package in at least one of its documentation files. The support for MathJax is experimental and may not work well.


logical flag controlling code highlighting, as described in Rd2HTML.


a filename or connection object to which to write the output. By default (NULL), the filename is inferred from hooks$pkg_href, which defaults to ‘pkg.html’.


Determines whether the entry for a help page in the table of contents is the name of the help page or its title.


additional arguments, passed on to Rd2HTML. The stages argument, if specified, is passed on to Rd_db.


logical: whether the output is intended to be a Rhtml file that can be processed using knitr. If TRUE, the examples section is wrapped inside a rcode block.


character string giving path of file containing configuration instructions for mathjax. Relevant only if texmath = "mathjax".


logical flag indicating whether the output should begin with the contents of the DESCRIPTION file.


The pkg2HTML function is intended to produce a single-page HTML reference manual for a given package, with links to other packages. The URLs of links to external packages are controlled by the provided hooks.

The handling of ⁠\Sexpr⁠-s are necessarily incomplete, but can be controlled to some extent by specifying the stages argument. Best results are likely for installed packages.


The name of the output file (invisibly).


Deepayan Sarkar

See Also

parse_Rd, Rd_db, Rd2HTML.


pkg2HTML("tools", out = tempfile(fileext = ".html")) |> browseURL()

[Package tools version 4.4.1 Index]