The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

downlit

R-CMD-check Codecov test coverage CRAN status

The goal of downlit is to provide syntax highlighting and automatic linking of R code in a way that is easily used from RMarkdown packages like pkgdown, bookdown, and hugodown.

Installation

Install downlit from CRAN with:

install.packages("downlit")

Features

downlit has two slightly different highlighting/linking engines:

Multiline code blocks have:

The following forms of inline code are recognized and automatically linked:

If downlit can find a pkgdown site for the remote package, it will link to it; otherwise it will link to https://rdrr.io/ for documentation, and CRAN for vignettes. In order for a pkgdown site to be findable, it needs to be listed in two places:

So when you build a pkgdown site that links to the dplyr documentation (e.g., dplyr::mutate()), pkgdown looks first in dplyr’s DESCRIPTION to find its website, then it looks for pkgdown.yml, and uses the metadata to generate the correct links.

Usage

downlit is designed to be used by other packages, and I expect most uses of downlit will use it via another package (e.g. hugodown). If you want to use it in your own package, you’ll typically want to apply it as part of some bigger transformation process. You can get some sense of how this might work by reading the source code of downlit_html() and downlit_md(), which transform HTML and markdown documents respectively.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.