← Back to all sparks
K

knitr

INFRA · APIS
Velocity0.0

Dynamic report generation in R combining code, results and prose

knitr adds OpenTelemetry tracing, turning document builds into observable pipelines

observabilityquartoliterate-programmingextensibilitymaintenance
Current state
knitr is the rendering engine underneath R Markdown and Quarto, and at 1.51 it is mature, heavily-constrained infrastructure. Most releases in this window are compatibility work: Quarto's pipe-comment chunk options, stricter fence parsing, and error messages that finally point at the right line. The 1.51 release breaks that pattern by adding tracing spans and knit lifecycle hooks.
Where it's heading
Two threads run through these releases. One is Quarto-era conformance - knitr keeps adjusting to a document format it no longer solely defines. The other is a slow move toward extensibility: chunk hooks gained a dots argument, then before- and after-knit hooks arrived, and helpers with no rendering relevance (combine_words, write_bib) are being pushed out to xfun. knitr is narrowing to the engine and opening the seams around it.
Prediction
Expect the hook surface to keep widening and more general-purpose helpers to migrate to xfun; if the OpenTelemetry work gets traction, richer per-chunk span attributes are the obvious next increment.

Recent moves

  1. 7mo ago

    OpenTelemetry tracing and before/after-knit hooks

    ⚡ SPARK

    The first release in this window to add capability rather than conform to someone else's: knit operations now emit OpenTelemetry spans per document and per chunk when otel and otelsdk are installed, and knitting gained before and after lifecycle hooks. Both land squarely on the extensibility thread that has been building since chunk hooks gained a dots argument.

    View source ↗
  2. 1y ago

    Inline-expression line numbers in error messages

    Error reporting gets specific: failures in inline code now name the inline expression's own line rather than the enclosing chunk's range, and vignette failures under R CMD build print a traceback. The offloading thread continues, with combine_words() and write_bib() reimplemented in xfun.

    View source ↗
  3. 1y ago

    Stricter chunk fences, alt text for LaTeX figures

    Mostly conformance work - unbalanced chunk fences are prohibited outright now, and fig.alt finally reaches LaTeX output through the includegraphics alt attribute. Letting chunks evaluate in a custom environment passed to knit_global() is the one piece of genuinely new surface.

    View source ↗
  4. 2y ago

    Fixes collapse=TRUE regression and a purl() path leak

    Two bug fixes: the collapse = TRUE regression from 1.46 that stopped merging code and multi-output results into one block, and hook_purl() writing the script path into the output document.

    View source ↗
  5. 2y ago

    kable() gains a global row cap; write_bib escapes ampersands

    Guardrails rather than features - knitr.kable.max_rows stops kable() from accidentally rendering an enormous table from a large object, and write_bib() escapes ampersands throughout the bibliography instead of only in the title field.

    View source ↗
  6. 2y ago

    spin() accepts percent and pipe chunk delimiters

    Broadens how a plain R script can be treated as a document: spin() recognizes both the percent-percent and pipe-comment delimiters used by notebook tooling elsewhere. Chunk hooks accepting a dots argument is the early move in the extensibility thread that 1.51 later builds on.

    View source ↗