litedown: A Lightweight Version of R Markdown

2025-01-21

Title A Lightweight Version of R Markdown
Version 0.5.6
Description Render R Markdown to Markdown (without using knitr), and Markdown to lightweight HTML or LaTeX documents with the commonmark package (instead of Pandoc). Some missing Markdown features in commonmark are also supported, such as raw HTML or LaTeX blocks, LaTeX math, superscripts, subscripts, footnotes, element attributes, and appendices, but not all Pandoc Markdown features are (or will be) supported. With additional JavaScript and CSS, you can also create HTML slides and articles. This package can be viewed as a trimmed-down version of R Markdown and knitr. It does not aim at rich Markdown features or a large variety of output formats (the primary formats are HTML and LaTeX). Book and website projects of multiple input documents are also supported.
Depends R (>= 3.2.0)
Imports utils, commonmark (>= 1.9.1), xfun (>= 0.50)
Suggests rbibutils, rstudioapi, tinytex
License MIT + file LICENSE
URL https://github.com/yihui/litedown
BugReports https://github.com/yihui/litedown/issues
VignetteBuilder litedown
Author Yihui Xie ORCID iD [aut, cre], Tim Taylor ORCID iD [ctb]

R-CMD-check CRAN release litedown on r-universe Codecov test coverage

This package provides a trimmed-down and reimagined implementation of R Markdown. It is much more lightweight, at the price of dropping some features. It does not depend on the R package knitr or the system package Pandoc.

Please consider this package experimental for now. The documentation is also very incomplete and still under development.

1 Usage

1.1 Installation

At the moment, you are recommended to install the development version from r-universe:

install.packages('litedown', repos = c('https://yihui.r-universe.dev', 'https://cloud.r-project.org'))

1.2 Markdown rendering

The function litedown::mark() is based on the R package commonmark, and renders Markdown to various output formats supported by commonmark, which are primarily HTML and LaTeX. MS Office formats are not supported.

1.3 Knitting

R Markdown documents need to be knitted to Markdown before being rendered to a target output format. The function litedown::fuse() plays a role similar to knitr::knit() and rmarkdown::render(). It fuses program code with narratives, i.e., it executes code in the source document and interweaves results with narratives in the output document.

1.4 Previewing

Try litedown::roam().

2 Scope

We want to limit the scope of this package. Most planned features have been (re-)implemented so far, such as reports, slides, books, websites (including package sites), and paged HTML documents, etc. See the set \(R\) below:

$$\mathrm{litedown} = \min{\{R\}} + \{D_i\} - \{D_e\} + \{J\}$$

Please feel free to file feature requests anyway, but we may be a little conservative when considering them (we will take votes into consideration, so please upvote features you like).

3 License

The litedown package is licensed under MIT.

Appendix

To cite the package litedown in publications, please use:

Xie Y (2025). litedown: A Lightweight Version of R Markdown. R package version 0.5.6, https://github.com/yihui/litedown.

@Manual{,
  title = {litedown: A Lightweight Version of R Markdown},
  author = {Yihui Xie},
  year = {2025},
  note = {R package version 0.5.6},
  url = {https://github.com/yihui/litedown},
}