mkdocstrings-R
An mkdocstrings handler for R. Write your documentation with roxygen2 comments, and this handler will render them into your MkDocs site.
Installation
uv add mkdocstrings-r
Requirements
- Python 3.10+
- R (accessible via
rpy2) - The
roxygen2R package
rpy2 also requires several system libraries (zstd, xz, bzip2, zlib,
icu). These are typically already present on most systems.
Quick start
Given an R file at R/math.R:
#' Add two numbers together.
#'
#' A simple function that computes the sum of two numeric inputs.
#'
#' @param x A numeric value.
#' @param y A numeric value.
#'
#' @returns A numeric value, the sum of `x` and `y`.
#'
#' @examples
#' add(1, 2)
#' add(-5, 10)
add <- function(x, y) {
x + y
}
Configure your mkdocs.yml:
plugins:
- mkdocstrings:
default_handler: R
Then reference the file in any Markdown page using dot-separated paths (without
the .R extension):
# API Reference
::: R.math
Or reference the handler directly:
# API Reference
::: R.math
handler: R
This renders documentation for every function in the file, including signature, description, parameters, return value, examples, and a collapsible source code block.
Supported roxygen2 tags
-
@title -
@description -
@details -
@param -
@return/@returns -
@examples
Markdown is supported within tag descriptions (e.g., inline code, lists, links).
Configuration
Handler options
Configure the handler in mkdocs.yml under
plugins > mkdocstrings > handlers > R:
plugins:
- mkdocstrings:
default_handler: R
handlers:
R:
lib_loc: "/path/to/R/library"
lib_loc
Path to the R library directory containing roxygen2. This is only needed if
rpy2 can't auto-detect your library location — for example, when using renv
and the renv/ folder isn't in the directory where you're running mkdocs.
To find your library paths, run .libPaths() in an R console.
How it works
- The handler converts your dot-separated identifier (e.g.,
R.math) to a file path (R/math.R) - It calls
roxygen2::parse_file()viarpy2to parse the roxygen2 comments - The parsed tags are mapped to a structured data model
- A Jinja template renders the data as HTML within your MkDocs site
Metadata
Release files for mkdocstrings-r 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocstrings_r-0.1.5.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocstrings_r-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / mkdocstrings_r-0.1.5.tar.gz
| Download URL | mkdocstrings_r-0.1.5.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbbbdf3ae72a33b161b0f0aba33c4e3db61fa07c6a9a0a724339dce146207219
|
|
BLAKE2b-256 checksum How to use checksums |
3643e4e762feee805e504719db60ed9d57543c590e494a33ab2a34e06ee53e7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mkdocstrings_r-0.1.5-py3-none-any.whl
| Download URL | mkdocstrings_r-0.1.5-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98e9d2e144f67dff7d26ac2fb8dd094ff677ccf0ff58d1454efcedf03eb8791a
|
|
BLAKE2b-256 checksum How to use checksums |
14e8d1aeadc56f89ca0e97781e223e6626dd93205152e86303016b345ac331fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|