Skip to content
Prev 8126 / 12125 Next

[R-pkg-devel] Sort order of vignette index?; adding purl'ed Rcode from asis vignette to vignette index?

Here is some suggested text to be added to the Writing R Extensions manual.
Any suggestions for changes?

1.4.3. Customizing the vignette help index

R provides two indices to the vignettes in a package  (a) the
browseVignettes() function and (b) the html index of vignettes and other
user documentation available when you use help(package=xxx). The latter is
built when the package is installed.



In some cases, customization of the html index is desirable. For example,
currently the entries in the index  are sorted by the vignette engine used
to build the vignette and then by the file name of the vignette and a
different sort order may be desired. Or additional documents may wish to be
included, e.g., the purl()?d code from an ?asis? vignette.



Previous sections of this guide indicate that if an ?index.html? file is
present in the inst/doc directory at the time of the build, then a new
?index.html? file will not be built. Previous sections also indicate how to
add additional files to the inst/doc directory. The following is then a
summary of the steps needed to customize the html index to the vignettes in
a package.



1. Create a revised ?index.html? file in the vignettes directory. It may be
easiest to copy an existing ?doc/index.html? file from an installed
package. The vignettes/index.html file should be in plain html and can be
modified to change the sort order or to add links to additional files to be
available to users. Note that files are referred to using relative path
names ? follow the pattern in the copied file.



2. Add any other additional files to the vignettes directory that are to be
available to the user via the vignette help index.



3. Add an ?.install_extras? file to the vignettes directory (don?t forget
the leading period in this file?s name). This is a text file with the names
of the files in the vignettes directory to be added to the inst/doc
directory. Each line can be coded as a regular expression. At a minimum,
include ?index.html? to copy the vignettes/index.html file to the inst/doc
directory.



4. Check/build the package in the regular way.



There is no evident way to modify the output of the browseVignettes()
function; however, this function currently sorts by the vignette file name
regardless of the vignette engine used.

On Wed, Jun 1, 2022 at 1:04 AM Martin Maechler <maechler at stat.math.ethz.ch>
wrote: