| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/package.R |
| 3 |
\name{pkg_desc} |
| 4 |
\alias{pkg_desc} |
| 5 |
\alias{pkg_news} |
| 6 |
\alias{pkg_code} |
| 7 |
\alias{pkg_citation} |
| 8 |
\alias{pkg_manual} |
| 9 |
\title{Print the package description, news, citation, manual pages, and source code} |
| 10 |
\usage{ |
| 11 |
pkg_desc(name = detect_pkg(), type = c("table", "dl")) |
| 12 |
|
| 13 |
pkg_news( |
| 14 |
name = detect_pkg(), |
| 15 |
path = detect_news(name), |
| 16 |
recent = 1, |
| 17 |
toc = TRUE, |
| 18 |
number_sections = TRUE, |
| 19 |
... |
| 20 |
) |
| 21 |
|
| 22 |
pkg_code( |
| 23 |
path = attr(detect_pkg(), "path"), |
| 24 |
pattern = "[.](R|c|h|f|cpp)$", |
| 25 |
toc = TRUE, |
| 26 |
number_sections = TRUE, |
| 27 |
link = TRUE |
| 28 |
) |
| 29 |
|
| 30 |
pkg_citation(name = detect_pkg()) |
| 31 |
|
| 32 |
pkg_manual( |
| 33 |
name = detect_pkg(), |
| 34 |
toc = TRUE, |
| 35 |
number_sections = TRUE, |
| 36 |
overview = TRUE, |
| 37 |
examples = list() |
| 38 |
) |
| 39 |
} |
| 40 |
\arguments{ |
| 41 |
\item{name}{The package name (by default, it is automatically detected from |
| 42 |
the \code{DESCRIPTION} file if it exists in the current working directory or |
| 43 |
upper-level directories).} |
| 44 |
|
| 45 |
\item{type}{The HTML tag for the description: \code{table} (\verb{<table>} with \verb{<tr>} |
| 46 |
and \verb{<td>}) or \code{dl} (definition list \verb{<dl>} with \verb{<dt>} and \verb{<dd>}).} |
| 47 |
|
| 48 |
\item{path}{For \code{\link[=pkg_news]{pkg_news()}}, path to the \code{NEWS.md} file. If empty, \code{\link[=news]{news()}} |
| 49 |
will be called to retrieve the news entries. For \code{\link[=pkg_code]{pkg_code()}}, path to the |
| 50 |
package root directory that contains \verb{R/} and/or \verb{src/} subdirectories.} |
| 51 |
|
| 52 |
\item{recent}{The number of recent versions to show. By default, only the |
| 53 |
latest version's news entries are retrieved. To show the full news, set |
| 54 |
\code{recent = 0}.} |
| 55 |
|
| 56 |
\item{toc}{Whether to add section headings to the document TOC (when TOC has |
| 57 |
been enabled for the document).} |
| 58 |
|
| 59 |
\item{number_sections}{Whether to number section headings (when sections are |
| 60 |
numbered in the document).} |
| 61 |
|
| 62 |
\item{...}{Other arguments to be passed to \code{\link[=news]{news()}}.} |
| 63 |
|
| 64 |
\item{pattern}{A regular expression to match filenames that should be treated |
| 65 |
as source code.} |
| 66 |
|
| 67 |
\item{link}{Whether to add links on the file paths of source code. By |
| 68 |
default, if a GitHub repo link is detected from the \code{BugReports} field of |
| 69 |
the package \code{DESCRIPTION}, GitHub links will be added to file paths. You |
| 70 |
can also provide a string template containing the placeholder \verb{\%s} (which |
| 71 |
will be filled out with the file paths via \code{sprintf()}), e.g., |
| 72 |
\verb{https://github.com/yihui/litedown/blob/main/\%s}.} |
| 73 |
|
| 74 |
\item{overview}{Whether to include the package overview page, i.e., the |
| 75 |
\code{{name}-package.Rd} page.} |
| 76 |
|
| 77 |
\item{examples}{A list of arguments to be passed to \code{\link[xfun:record]{xfun::record()}} to run |
| 78 |
examples each help page, e.g., \code{list(dev = 'svg', dev.args = list(height = 6))}. If not a list (e.g., \code{FALSE}), examples will not be run.} |
| 79 |
} |
| 80 |
\value{ |
| 81 |
A character vector (HTML or Markdown) that will be printed as is |
| 82 |
inside a code chunk of an R Markdown document. |
| 83 |
|
| 84 |
\code{pkg_desc()} returns an HTML table containing the package metadata. |
| 85 |
|
| 86 |
\code{pkg_news()} returns the news entries. |
| 87 |
|
| 88 |
\code{pkg_code()} returns the package source code under the \verb{R/} and |
| 89 |
\verb{src/} directories. |
| 90 |
|
| 91 |
\code{pkg_citation()} returns the package citation in both the plain-text |
| 92 |
and BibTeX formats. |
| 93 |
|
| 94 |
\code{pkg_manual()} returns all manual pages of the package in HTML. |
| 95 |
} |
| 96 |
\description{ |
| 97 |
Helper functions to retrieve various types of package information that can be |
| 98 |
put together as the full package documentation like a \pkg{pkgdown} website. |
| 99 |
These functions can be called inside any R Markdown document. |
| 100 |
} |
| 101 |
\examples{ |
| 102 |
\dontrun{ |
| 103 |
litedown::pkg_desc() |
| 104 |
litedown::pkg_news() |
| 105 |
litedown::pkg_citation() |
| 106 |
} |
| 107 |
} |