The R Project SVN R

Rev

Rev 88454 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
86206 deepayan 1
% File src/library/tools/man/pkg2HTML.Rd
2
% Part of the R package, https://www.R-project.org
3
% Copyright 2024 R Core Team
4
% Distributed under GPL 2 or later
5
 
6
\name{pkg2HTML}
7
\alias{pkg2HTML}
8
\title{ Rd Converters }
9
\description{
10
  Generate a single-page HTML reference manual from the Rd sources
11
  contained in an installed or source R package.
12
}
13
\usage{
14
pkg2HTML(package, dir = NULL, lib.loc = NULL,
15
         outputEncoding = "UTF-8",
86341 smeyer 16
         stylesheet = file.path(R.home("doc"), "html", "R-nav.css"),
86206 deepayan 17
         hooks = list(pkg_href = function(pkg) sprintf("\%s.html", pkg)),
18
         texmath = getOption("help.htmlmath"),
19
         prism = TRUE,
20
         out = NULL,
88454 hornik 21
         toc_entry = c("name", "title"),
86206 deepayan 22
         ...,
23
         Rhtml = FALSE,
86429 deepayan 24
         mathjax_config = file.path(R.home("doc"), "html", "mathjax-config.js"),
88957 hornik 25
         include_description = TRUE,
26
         concordance = FALSE)
86206 deepayan 27
}
28
\arguments{
86432 deepayan 29
  \item{package}{ typically a character string giving the name of an
30
    installed package. Can also be a file path or URL pointing to a source
31
    tarball (this feature is experimental).
86206 deepayan 32
  }
33
  \item{dir}{ character string giving the path to a directory containing
34
    an installed or source package.
35
  }
36
  \item{lib.loc}{a character vector describing the location of \R
37
    library trees to search through, or \code{NULL}. Passed on to
38
    \code{\link{find.package}} and \code{\link{Rd_db}}.
39
  }
40
  \item{outputEncoding}{ character string; see \code{\link{Rd2HTML}}. }
41
  \item{stylesheet}{ character string giving URL containing CSS style
42
    information.
43
  }
44
  \item{hooks}{A list of functions controlling details of
45
    output. Currently the only component used is \code{pkg_href}, which
46
    is used to determine the output HTML file path given a package name
47
    as input.
48
  }
86429 deepayan 49
  \item{texmath}{ character string controlling math rendering library to
50
    be used, either \code{"katex"} or \code{"mathjax"}. The default is
51
    to use \code{"katex"}, unless the package appears to use the
52
    \code{\link[mathjaxr]{mathjaxr}} package in at least one of its
86447 hornik 53
    documentation files. The support for \I{MathJax} is experimental and may
86429 deepayan 54
    not work well.
86206 deepayan 55
  }
86429 deepayan 56
  \item{prism}{ logical flag controlling code highlighting, as described in
57
    \code{\link{Rd2HTML}}.
58
  }
86206 deepayan 59
  \item{out}{a filename or connection object to which to write the
86496 smeyer 60
    output.  By default (\code{NULL}), the filename is inferred from
61
    \code{hooks$pkg_href}, which defaults to \file{\var{pkg}.html}.}
86392 deepayan 62
  \item{toc_entry}{ Determines whether the entry for a help page in the
63
    table of contents is the name of the help page or its title. }
86206 deepayan 64
  \item{...}{additional arguments, passed on to
65
    \code{\link{Rd2HTML}}. The \code{stages} argument, if specified, is
66
    passed on to \code{\link{Rd_db}}.
67
  }
68
  \item{Rhtml}{logical: whether the output is intended to be a \I{Rhtml}
69
    file that can be processed using \CRANpkg{knitr}. If \code{TRUE}, the
70
    examples section is wrapped inside a \code{rcode} block.
71
  }
86429 deepayan 72
  \item{mathjax_config}{ character string giving path of file containing
86447 hornik 73
    configuration instructions for \I{MathJax}. Relevant only if
86429 deepayan 74
    \code{texmath = "mathjax"}.
75
  }
86206 deepayan 76
  \item{include_description}{ logical flag indicating whether the output
77
    should begin with the contents of the \code{DESCRIPTION} file.
78
  }
88957 hornik 79
  \item{concordance}{ logical flag indicating whether the output
80
    should contain concordance information.}
86206 deepayan 81
}
82
 
83
\details{
84
  The \code{pkg2HTML} function is intended to produce a single-page HTML
85
  reference manual for a given package, with links to other
86
  packages. The URLs of links to external packages are controlled by the
87
  provided hooks.
88
 
89
  The handling of \verb{\Sexpr}-s are necessarily incomplete, but can be
90
  controlled to some extent by specifying the \code{stages}
91
  argument. Best results are likely for installed packages.
92
}
93
 
94
\value{
86341 smeyer 95
  The name of the output file (invisibly).
86206 deepayan 96
}
97
\author{
98
  Deepayan Sarkar
99
}
100
\seealso{
101
  \code{\link{parse_Rd}}, \code{\link{Rd_db}},
102
  \code{\link{Rd2HTML}}.
103
}
104
\examples{
105
\donttest{
106
pkg2HTML("tools", out = tempfile(fileext = ".html")) |> browseURL()
107
}
108
}
109
\keyword{ documentation }