roxygen2 6.1.0
New features
-
The NAMESPACE roclet nows works in two passes - it first generates the
a NAMESPACE containing only import directives becaues this can be generated
without evaluating the code in the package. This alleviates a problem
where it was previously possible to get into a state that you could only
get out of by carefully editting the NAMESPACE by hand (#372). -
@evalRd foo()
evaluatesfoo()
defined in the package namespace and inserts
the results into the current block (#645). The code should return a character
vector with one entry for each line (and they should not start with#'
).There are two small limitations to the current implementation:
- The generated roxygen will not affect the
@md
/@noMd
status @evalRd
does not work inside templates.
- The generated roxygen will not affect the
-
@evalNamespace
does forNAMESPACE
what@evalRd
does for Rd files:
you give it R code that produces a literal entry inNAMESPACE
when
run. This should make it easier to export functions that are generated by
other functions in your package (#531, @egnha). -
@inherits
can now inherit examples (#588). -
vignette("rd")
received a thorough updating for current best-practices.
The vignette still needs more work so pull requests are greatly appreciated
(#650). -
roxygenise()
usespkgload::load_all()
instead of a home grown solution
to simulate package loading (this is needed because roxygen2 uses run-time
information to generate the documetation). This should reduce S4 related
problems and ensures thatdevtools::document()
androxygenise()
always
have exactly the same behaviour (#568, #595). -
If an inherited section cannot be found, the warning contains the help
page from which that section was requested (#732, @krlmlr). -
roxygen2 now always reads and writes using UTF-8 encoding. If used with a
package that does not haveEncoding: UTF-8
in the DESCRIPTION, you'll
now get a warning (#564, #592).
Extension API
-
Roxygen blocks now have an official structure as encoded in
roxy_block()
. It is a named list containing the tags with attributes
providing other metadata. -
The
parsed
argument toroclet_process()
have been replaced with
separateblocks
andenv
arguments. -
New
roclet_preprocess()
generic makes it possible for roclets to perform
actions before code is evaluated. -
parse_package()
,parse_file()
andparse_code()
provide an exported API
that allows you to use roxygen's parsing code independently of creating
roclets.
Minor improvements and bug fixes
-
All tags (including
@alias
) are now de-duplicated and consistently sorted.
This reduces spurious diffs (#586, @flying-sheep). -
@concept
now generates one\concept
per tag (#611). -
The default
@description
(i.e. the title) is now added much later in the
process. That means that@inherit description
now works when you have
specified a title for the inheritor (#629) and the default description
is slightly nicer when merging multiple blocks. -
@family
automatically adds its value to concepts (#611). -
@inherits
: The mechanism for extracting inherited Rd does a better job of
preserving escapes (#624) -
Empty
.Rbuildignore
now handled correctly (#576). -
Stricter regular expression ensures only files ending with
.R
or.r
are
parsed for roxygen comments (#625). -
Objects with names starting with a dot are now by default documented in
files with prefix 'dot-'. -
Roclets can now access global options as designed. This allows templates to
use markdown formatting if set globally (#594). -
You can now autogenerate package documentation even if you don't have
Authors@R
(#606). -
Multiple given and/or family names are now supported in the
Authors@R
field of the DESCRIPTION file (#672, @sgibb). -
If a package logo exists (
man/figures/logo.png
) it will be automatically
included in generated package docs (#609). -
Usage for data objects now correctly generated, avoiding double escaping
other components of usage (#562). -
Improvements to markdown translation:
-
Code in link text is now properly rendered as code (#620, @egnha).
-
Whitespace between words in link text is now preserved as single
space for links of the form[text][fcn]
and[text](URL)
(#628, #754, #760, @egnha and @jennybc). -
%
in inline code (#640), code blocks (@nteetor, #699) and
links (#724) is now automatically escaped. -
Parsing of markdown links has been tweaked to reduce false positives
(#555). If you still get a false positive, you can now put\\
in front
of the[
to avoid it being converted to a link (#720). Links can no
longer be followed by{
to avoid spurious matches to Rd commands like
\Sexpr{}
. -
Unsupported markdown features now generate a mildly helpful warning
instead of throwing an utterly useless error (#560).
-
-
person()
now supports all
MARC Relator role codes
(#662, @Publicus). -
topic_add_usage()
now outputs formatted "Usage" section with max
width of 80 characters thanks to a now more flexiblewrap_string()
(@JoshOBrien, #719).