Report
Available format: 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- (Markdown, two languages) and report-study (MDX). The four
data directives are on Data directives.
A minimal report
report.md
recit init -- writes this starter and its data/.
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:.
YAML
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.): 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/ ends with such a
section.
Settings
In the front matter; the report: section of recit. gives the defaults of every report
of a folder, and the front matter wins.
| Setting | Default | What it does |
|---|---|---|
toc | true | the side table of contents, a drawer on a phone |
numbering | false | numbered section headings |
interactive | true | keyboard navigation, arrow keys and a tooltip on charts in the browser |
print | printed layout (print.layout: "document", "poster" or "banner"), and print. | |
theme | a named theme; report is the reading theme of the format | |
pdf | A4 | the PDF options, below |
theme. in recit. 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:), is a warning (report-) in recit dev, recit build,
recit validate and a site: the report: section of recit. applies, or else the
default. A toc no schema accepts (toc: "no") is an error of the front matter
(frontmatter-), 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: keeps the charts static.
| Key | What it does |
|---|---|
report.toc | the side table of contents, as toc above |
report. | numbered section headings, as numbering above |
report. | interactive charts in the browser, as interactive above |
report.print | printed layout (print.layout: "document" by default, "poster" for a one-page poster grid, or "banner" for a single-page banner strip), and print. (below) |
report.rules | the deck's density rules, plus hardcodedNumbers (default on): a warning on a number written by hand in prose |
report.pdf | the PDF options of every report, the same keys as pdf: in the front matter |
recit.config.ts
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- warning at
its file and line, one per prose block, quoting the first number and counting any others in the same
block. recit validate -- turns report- into an error (exit code 1);
recit build and the rendered page keep it as a warning, and rules. turns
it off.
Excluded from the check:
- standalone 4-digit years from
1000to2199and 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, imagealttext, directive attributes, values rendered by the data directives,:::notesand the front matter.
The PDF
recit export -- 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.). The title of the report runs in the
header and {page} / 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. (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:) reads CSS
target-. toc: removes the page numbers:
YAML
An external link prints its address in parentheses after its text, unless the text is already the address.
print: (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.
YAML
Poster
With print:, the printable view lays the report out on a single-page poster
grid; recit export -- 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: 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.
Banner
With print:, 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. width (and wrapped full-width budgets at or below 24em /
384px, such as 300px × 250px), raising report- warnings with the source line or JSON
pointer (recit validate -- turns report- into an error, exit code 1).
recit export -- 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:) 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 -- captures a poster or banner report (print. or
"banner") as PNG: <output>/ at the layout's natural size by default,
<output>/ into one folder per preset of --preset (og-image, mpu,
leaderboard), or <output>/ 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:) 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 /), contained and
centred inside the frame; any target further apart (for example mpu on a default 728×90 banner
without a closer pdf.) is refused before writing any file. A report without
print. or "banner" has no page images and is refused; pass --charts to export
its ::chart figures instead.
Bash
leaderboard (728×90) and mpu (300×250) are too far apart to come from one layout: a banner sized
for an mpu sets pdf. to a close size ({ width:), 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:
Markdown
| Attribute | Default | Values |
|---|---|---|
url | — | required http:// or https:// address (javascript: and data: are refused) |
label | url | text printed in clear underneath (<figcaption>); defaults to the full address |
size | 30mm | side length in mm or px (30mm, 240px) |
level | M | error correction level: L (7 %), M (15 %), Q (25 %) or H (30 %) |
utm | — | source: (overrides recit.config's utm field by field), or none to strip all |
The directive renders a <figure class= with a crisp vector <svg role=
(shape-, #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):
Markdown
The JSON twin
Every report has a typed JSON twin (kind:, format:), with its data and its
settings, checked by https:// and converted both ways by
recit convert. The examples report- and report-study keep theirs on disk
(quarterly., study.).
Bash
A report section has no format-specific typed field: scenes uses the shared scene keys (see
Scenes › In the JSON twin), while a
kind: companion completes sections by id.
| Key | Type / values | Effect |
|---|---|---|
scenes | object[] | Required in kind:. Sections of the report, in order (--- separators in Markdown). |
scenes.id | string (non-empty) | Required. Stable section identifier across languages (--- id=… in Markdown; Scenes). |
scenes.body | string or Record<string, string> | Optional Markdown or MDX prose and data directives of the section (Scenes). |
scenes.notes | string or Record<string, string> | Optional author notes in Markdown (:::notes; Scenes). |
scenes.attrs | Record<string, string | number | boolean> | Optional separator attributes (--- key=) other than id (Scenes). |
Commands
| Command | What it does |
|---|---|
recit dev report.md | the report with live reload, its data read again when a source changes |
recit build report. | the report as static files (-o, --output, ./dist) |
recit validate report.md | the story against its schema, its data loaded and each data directive evaluated |
recit convert report. | the JSON twin; --to md goes back to Markdown |
recit export -- | one self-contained HTML file |
recit export -- | the PDF of the printable view, listed in exports.json (--locale fr for one language) |
recit export -- | PNG images of a poster or banner (--preset, --size; --charts for ::chart figures) |
Every command and its flags are in the CLI reference.
Bridges
| From → to | How |
|---|---|
| report → deck | recit convert report. |
| report → webstory | recit convert report. |
recit convert report. writes a deck, one slide per section with the same id, the
data directives kept (reportToDeck of @recit/). 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. tells each key figure and each chart of the report as a card
(reportToWebstory of @recit/, 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
TypeScript
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-).
| Import | Contents |
|---|---|
@recit/ | storyToReport, toReportView and the view types, no React |
@recit/ | the components (Report, ReportToc…) |
@recit/ | mountReport, the page of recit dev and recit build |
@recit/ | ReportPrint, ReportBanner and bannerFitIssues, the printable view and its banner strip |
@recit/ | reportToDeck |
@recit/ | renderMdxReport, the sections of a report written in MDX (Node) |
@recit/ | the stylesheet of the report |
@recit/data | the sources, the aggregates and the charts the directives compute |