Skip to content

Report

Available format: report turns a story into a data report: one continuous page, one section per scene, a table of contents beside it, and a PDF. Every number it shows comes from its data, never from the text: :value, ::chart, ::table and :::kpi read the sources of data: at build time, so changing the CSV and rebuilding updates the prose, the charts and the tables together.

The examples are report-quarterly (Markdown, two languages) and report-study (MDX). The four data directives are on Data directives.

A minimal report

Markdownreport.md
--- title: Lorem Ipsum Report format: report lang: en data: sales: ./data/sample.csv toc: true --- --- id=summary ## Summary Revenue reached :value{data=sales field=revenue agg=sum format=currency currency=EUR} over the year. ::chart{data=sales type=line x=month y=revenue title="Monthly revenue"}

recit init --format report writes this starter and its data/sample.csv.

Data sources

data: names each source. A path is a CSV, JSON or YAML file relative to the story; its column types are inferred from the first 100 rows (number, boolean, date, string) or declared under columns:; a later cell that does not fit is an error that names its line. In a CSV every cell is text, so 2025 reads as a number; in JSON, YAML or inline rows a value keeps the type it is written with, so a quoted "2025" stays text and is never grouped by thousands. A number is written with a decimal point and no thousands separator, and fits a double: 1e400 is not a number, never ∞. Rows can also be written inline under rows:.

YAMLYAML
data: sales: ./data/sales.csv regions: src: ./data/regions.json columns: { name: string, revenue: number } targets: rows: [{ quarter: 2026-Q4, revenue: 50000 }] meta: title: Dolor sit amet publisher: Lorem Ipsum Institute license: CC-BY-4.0 modified: 2026-11-01 url: https://example.org/lorem

An inline source (or a plugin source) may carry optional meta provenance with DCAT field names (title, url, publisher, license, modified). When ::chart omits source=, it composes its Source: line from publisher, title and (license) automatically (source="" suppresses it).

The files are read in Node, at build time. The rows never reach the browser: only the numbers shown do. A missing file, an empty source or a cell that does not fit its type is an error with the line. The four directives are described in Data directives.

MDX

A report can be written in MDX (study.story.mdx): a section then adds JSX and expressions to the Markdown, next to the same data directives. Its sections are rendered to HTML once, at build time, like the Markdown ones, so the page still receives no rows. A report cannot import a module: its page is built from JSON, and an import is an error. examples/report-study ends with such a section.

Settings

In the front matter; the report: section of recit.config.ts gives the defaults of every report of a folder, and the front matter wins.

SettingDefaultWhat it does
toctruethe side table of contents, a drawer on a phone
numberingfalsenumbered section headings
interactivetruekeyboard navigation, arrow keys and a tooltip on charts in the browser
printprinted layout (print.layout: "document", "poster" or "banner"), and print.glossary
themea named theme; report is the reading theme of the format
pdfA4the PDF options, below

theme.customCss in recit.config.ts applies to a report last, as it does to a deck.

A numbering or interactive that is not true or false, or a toc that is an object (the deck's toc: { depth: 1 }), is a warning (report-invalid-setting) in recit dev, recit build, recit validate and a site: the report: section of recit.config.ts applies, or else the default. A toc no schema accepts (toc: "no") is an error of the front matter (frontmatter-invalid), and the JSON twin's schema refuses any value but true or false.

In the browser, every chart gets one Tab stop, arrow keys across its values, a polite live region and a tooltip read from its "Data" table (loaded in its own chunk in a site when a story holds an interactive chart); the server HTML, the PDF and image exports are unchanged, and interactive: false keeps the charts static.

KeyWhat it does
report.tocthe side table of contents, as toc above
report.numberingnumbered section headings, as numbering above
report.interactiveinteractive charts in the browser, as interactive above
report.printprinted layout (print.layout: "document" by default, "poster" for a one-page poster grid, or "banner" for a single-page banner strip), and print.glossary (below)
report.rulesthe deck's density rules, plus hardcodedNumbers (default on): a warning on a number written by hand in prose
report.pdfthe PDF options of every report, the same keys as pdf: in the front matter
TypeScriptrecit.config.ts
import { defineConfig } from "recit/config"; export default defineConfig({ metadata: { author: "Lorem Ipsum Studio" }, report: { toc: true, numbering: false, print: { layout: "document" }, interactive: true, rules: { hardcodedNumbers: true }, pdf: { page: { size: "A4" } }, }, });

Numbers written by hand

A number written in the prose of a report (paragraphs, list items, blockquotes, headings and Markdown table cells) instead of computed with :value{…} raises a report-hand-number warning at its file and line, one per prose block, quoting the first number and counting any others in the same block. recit validate --strict turns report-hand-number into an error (exit code 1); recit build and the rendered page keep it as a warning, and rules.hardcodedNumbers: false turns it off.

Excluded from the check:

  • standalone 4-digit years from 1000 to 2199 and year spans (2025–2026, 2025-2026), and ISO dates (2026-03-01);
  • section numbers at the start of a heading (2., 3.1, IV.), ordinals (1er, 1re, 2e, 2ème, 3rd, 21st, 2nd, 4th, XIXe) and footnote calls ([^1]);
  • digits attached to letters of a name or code (A4, COVID-19, H2O, G7, mp4), as well as code spans and blocks, link URLs and targets, image alt text, directive attributes, values rendered by the data directives, :::notes and the front matter.

The PDF

recit export --to pdf report.md prints the printable view of the report: a title page, the table of contents in links, the sections in order, figures and key figures never cut, the header row of a long table repeated, bookmarks from the section titles. A4 with 20 mm margins unless pdf: says otherwise; a custom page size (such as an 850×2000 mm roll-up banner) is laid out at its true size (recit export story.md --to pdf --page-size 850mmx2000mm). The title of the report runs in the header and {page} / {pages} in the footer; header: {} and footer: {} remove them.

pdf: takes the PDF options of every paginated format (outline, tagged, colorMode, output, page, toc, header, footer), plus engine (chromium by default, or pagedjs) and tables.repeatHeader (default true).

The table of contents of the PDF is numbered by default, with both engines: Chromium prints two or three times to read the page of each target, and Paged.js (engine: pagedjs) reads CSS target-counter. toc: { pageNumbers: false } removes the page numbers:

YAMLYAML
pdf: toc: pageNumbers: false

An external link prints its address in parentheses after its text, unless the text is already the address.

print: { glossary: true } (default false) ends the printed document with a glossary: the terms of the project's glossaries its sections use (:term), sorted by name in the language of the report, each with its short definition and the page of every use. In print, a term is a link to its entry instead of a hover card. The contents list the glossary, and both engines number its pages, like the contents. A poster or a banner has no glossary.

YAMLYAML
print: glossary: true

Poster

With print: { layout: "poster" }, the printable view lays the report out on a single-page poster grid; recit export --to pdf refuses a poster that takes more than one page because a poster is meant to be read at a glance on one sheet rather than split across pages.

Bleed and crop marks

For a printed poster (A3, A2, or a custom { width, height }), pdf: { engine: pagedjs, page: { bleed: 3mm, marks: crop } } adds bleed around the trim and crop marks (crop by default when bleed is set, cross, or crop cross; pagedjs only). The PDF stays in RGB: CMYK is out of scope, and the printer converts.

With print: { layout: "banner" }, the printable view renders a single-page banner strip (728px × 90px by default, zero margins, no running header or footer) holding the report title, the first :value, the first link as a call to action and the brand signature. recit validate estimates without a browser whether the title, value and call to action stay within character budgets scaled to pdf.page.size width (and wrapped full-width budgets at or below 24em / 384px, such as 300px × 250px), raising report-banner-fit warnings with the source line or JSON pointer (recit validate --strict turns report-banner-fit into an error, exit code 1). recit export --to pdf measures the rendered boxes and the brand signature against their boxes and the banner's inner box in Chromium before printing, warning in the console and under warnings (code: "overflow") in exports.json when a part is cut (--strict fails the export instead), and refuses a banner that overflows onto more than one page.

recit export --to images captures a poster or banner report (print.layout: "poster" or "banner") as PNG: <output>/<story>.png at the layout's natural size by default, <output>/<preset>/<story>.png into one folder per preset of --preset (og-image, mpu, leaderboard), or <output>/<W>x<H>/<story>.png for --size <W>x<H>, all listed in exports.json. When a banner part is cut or a poster or banner overflows its page box, the capture warns in the console and records warnings (code: "overflow") on the file entry in exports.json; --strict fails the export without writing any PNG or exports.json. As for a deck, each requested preset or --size must stay within 25% of the print.layout page aspect ratio (max(rTarget / rLayout, rLayout / rTarget) ≤ 1.25), contained and centred inside the frame; any target further apart (for example mpu on a default 728×90 banner without a closer pdf.page.size) is refused before writing any file. A report without print.layout: "poster" or "banner" has no page images and is refused; pass --charts to export its ::chart figures instead.

TerminalBash
recit export banner.md --to images --preset leaderboard recit export banner.md --to images --size 1456x180

leaderboard (728×90) and mpu (300×250) are too far apart to come from one layout: a banner sized for an mpu sets pdf.page.size to a close size ({ width: "300px", height: "250px" }), then exports with --preset mpu.

QR code

::qr draws a vector QR code at build time so a printed report, a poster, a web story card or a slide can link back to its online page without a bitmap:

MarkdownMarkdown
::qr{url="https://example.com/report" label="example.com/report" size="30mm" level="M"}
AttributeDefaultValues
url—required http:// or https:// address (javascript: and data: are refused)
labelurltext printed in clear underneath (<figcaption>); defaults to the full address
size30mmside length in mm or px (30mm, 240px)
levelMerror correction level: L (7 %), M (15 %), Q (25 %) or H (30 %)
utm—source:…,medium:…,campaign:… (overrides recit.config's utm field by field), or none to strip all

The directive renders a <figure class="recit-qr"> with a crisp vector <svg role="img"> (shape-rendering="crispEdges", #000 modules on a #fff quiet zone) carrying an accessible name in the story's language (QR code to https://… in English, Code QR vers https://… in French), and the address or label in clear underneath (<figcaption>) so a reader can also type it. In the JSON twin as in the .md source, ::qr stays in the Markdown of the scene's body.

When utm is set in recit.config or on the directive, utm_source, utm_medium (qr when omitted) and utm_campaign are added to the address encoded in the QR matrix without overwriting any utm_* parameter already present in url, while the printed <figcaption> and aria-label keep the short original address (utm="none" skips tracking on a single code):

MarkdownMarkdown
::qr{url="https://example.com/report" utm="source:poster,campaign:lorem"}

The JSON twin

Every report has a typed JSON twin (kind: "story", format: "report"), with its data and its settings, checked by https://recit.dev/schema/v1/report.json and converted both ways by recit convert. The examples report-quarterly and report-study keep theirs on disk (quarterly.story.json, study.story.json).

TerminalBash
npx recit convert report.md --to json -o report.json

A report section has no format-specific typed field: scenes uses the shared scene keys (see Scenes › In the JSON twin), while a kind: "sidecar" companion completes sections by id.

KeyType / valuesEffect
scenesobject[]Required in kind: "story". Sections of the report, in order (--- separators in Markdown).
scenes.idstring (non-empty)Required. Stable section identifier across languages (--- id=… in Markdown; Scenes).
scenes.bodystring or Record<string, string>Optional Markdown or MDX prose and data directives of the section (Scenes).
scenes.notesstring or Record<string, string>Optional author notes in Markdown (:::notes; Scenes).
scenes.attrsRecord<string, string | number | boolean>Optional separator attributes (--- key=value) other than id (Scenes).

Commands

CommandWhat it does
recit dev report.mdthe report with live reload, its data read again when a source changes
recit build report.md -o distthe report as static files (-o, --output, ./dist)
recit validate report.mdthe story against its schema, its data loaded and each data directive evaluated
recit convert report.md --to jsonthe JSON twin; --to md goes back to Markdown
recit export --html report.mdone self-contained HTML file
recit export --to pdf report.mdthe PDF of the printable view, listed in exports.json (--locale fr for one language)
recit export --to images banner.mdPNG images of a poster or banner (--preset, --size; --charts for ::chart figures)

Every command and its flags are in the CLI reference.

Bridges

From → toHow
report → deckrecit convert report.md --to deck
report → webstoryrecit convert report.md --to webstory

recit convert report.md --to deck writes a deck, one slide per section with the same id, the data directives kept (reportToDeck of @recit/report/bridge). A ::table longer than eight rows gets limit=8; a ::chart beside a :::kpi or a ::table moves to a slide of its own (<id>-chart, under the section's title), so it keeps the slide's width; prose a slide cannot hold is an error with its line, never an invented summary. -o deck.json writes the deck's twin instead.

recit convert report.md --to webstory tells each key figure and each chart of the report as a card (reportToWebstory of @recit/webstory, owned by its target so the report does not depend on the webstory format). A key figure's card shows its :value, its label under it, then its note.

Packages

TypeScriptTypeScript
import fs from "node:fs"; import { compileStory, DataSourcesSchema, extractDeckFrontmatter, } from "@recit/core"; import { dataDirectives } from "@recit/data/directives"; import { loadDataSources } from "@recit/data/node"; import { storyToReport } from "@recit/report"; const markdown = fs.readFileSync("report.md", "utf-8"); // The `data:` sources of the front matter, read relative to the report const { metadata } = extractDeckFrontmatter(markdown); const data = await loadDataSources( DataSourcesSchema.parse(metadata.data ?? {}), { baseDir: "." }, ); const story = await compileStory(markdown, { file: "report.md", // The handlers of :value, ::chart, ::table and :::kpi over those sources directives: dataDirectives(data.tables), }); const { report, diagnostics } = storyToReport(story);

This is what recit dev and recit build do. A report without data directives needs only compileStory and storyToReport; without directives, a data directive is an error (directive-without-handler).

ImportContents
@recit/reportstoryToReport, toReportView and the view types, no React
@recit/report/componentsthe components (Report, ReportToc…)
@recit/report/runtimemountReport, the page of recit dev and recit build
@recit/report/printReportPrint, ReportBanner and bannerFitIssues, the printable view and its banner strip
@recit/report/bridgereportToDeck
@recit/report/noderenderMdxReport, the sections of a report written in MDX (Node)
@recit/report/styles.cssthe stylesheet of the report
@recit/datathe sources, the aggregates and the charts the directives compute