Skip to content

Web stories

Available format: webstory turns a storyStoryThe compiled model, Story: one source, which every format reads. into a web story: full-screen cards in 9:16, read one tap at a time, like the stories of a social network. Every scene is a card: one idea, a background and, if you want, a call to action. Its name, webstory, keeps it apart from the story model every format reads.

The syntax, its JSON twin and the player of @recit/webstory are ready: recit dev, recit build, recit validate, recit convert and recit i18n check read a story, a Récit site publishes it, recit export --to images writes one picture per card (Commands) and recit render turns it into a 9:16 film (Commands). A story has no PDF. aspectRatio: 4:5 or 1:1 makes the same cards a portrait or a square post: the player, the images and the film follow.

A minimal story

Markdownlaunch.md
--- title: Lorem Launch lang: en format: webstory autoplay: false dur: 5 --- --- id=hook background=gradient # Lorem ipsum. --- id=proof type=stat background=#2a1f4f ```yaml value: "42" label: Lorem ipsum dolor ``` --- id=list background=theme ## Sed do eiusmod - Tempor incididunt - Ut labore --- id=cta background=#1d1640 # Try it now ::cta[Get started]{href=https://recit.dev}

examples/webstory-launch holds a complete story in English and French: a title over a picture, a kicker, a stat block, a list, a quote and a call to action.

Settings

In the front matter, or for every story of a folder in the webstory: section of recit.config.ts (the front matter wins). The same keys, nested, are the settings of the JSON twin.

SettingDefaultWhat it does
aspectRatio9:169:16, or the posts 4:5 (1080×1350) and 1:1 (1080×1080)
autoplayfalsecards advance on their own; the reader taps by default (accessible)
dur5seconds per card in autoplay
loopfalseback to the first card after the last one
imagesnoneoptions of --to images: format, scale, cards, maxBytes
images.formatpngencoding of each card: png, jpeg or webp
images.scale3device scale of the 360×640 capture, up to 4
images.cardsevery cardonly these cards, by id
images.maxBytesnonea card heavier than this gives a warning
images.presetsnonethe output presets the story is made for: exported by default, checked by recit validate
brandnonesignature (logo, mention, position, inFilm, color), overriding recit.config (preview)
variantsnone.csv, .json or .yaml table (front matter / twin settings) for {{…}} placeholders

With variants: and brand:, one story declines across places or partners and stamps its corner signature on every card (above ::cta) and, with brand.inFilm: true, on every shot of its film: see Variants and signature.

With images.presets (for example [instagram-story, tiktok]), recit export --to images captures each preset into its own folder without --preset, and recit validate warns about a card whose text or call to action likely falls where the app draws its own buttons. It is an estimate from the layout of the player; recit dev shows the same margins over the card (the Safe area button, or the key G). A preset of another ratio than the story's is an error.

cover (front matter only) is the round thumbnail of the story in a rail: a color or an image.

Cards

A card starts with its separator line, --- id=… key=value. Keep one idea per card: recit validate refuses more than 40 words or 5 list items on a card, with its line, and warns past 30 cards or a background heavier than 500 KB.

AttributeMeaning
idstable id: languages, companions and ?card=<id> find the card by it
backgrounda color (#2a1f4f), theme, gradient, pixel:<seed>, an image or a short muted video (.mp4, .webm)
alttext alternative of an image or a video background, required for them
overlayreadability gradient: none (default), top, bottom or full
durseconds on screen in autoplay
holdextra seconds after a motion block settles
typea motion block (title, statement, stat, list…), its props in a ```yaml block
accentaccent color of this card alone when played by a motion block, like a scene of a film

background=pixel:<seed> draws a seeded pixel texture behind the card: a gen=noise texture (see the ::pixel directive of the motion format) of the card's ratio, about a third of its cells in the theme's accent and muted colours, over the card's dark ground. The same seed gives the same texture everywhere; a number up to 4294967295 or a word (pixel:lorem). It is decorative and needs no alt. A film or a webtoon made from the story takes its own theme instead.

accent= (scenes.accent in the JSON twin) replaces the theme accent on that card alone (highlighted bar, curve, emphasized words; a card without type= ignores accent), and a card converted from a film (motionToWebstory) keeps its accent:

MarkdownMarkdown
--- type=stat accent=#0f766e

::cta[Label]{href=…} is the last line of its card: a button at the bottom, reached by the keyboard, opened by a click or a swipe up. :::notes holds a note that is never shown, the voice-over of the film.

A story with a bible (cast:) can draw a character the bible describes on a card, as a still figure (preview, @recit/character): ::character{character=lorem pose=waving}, or the first image of one of its cycles with animation=. See the deck page for its attributes. A character with a sprite sheet (::sheet in the bible) shows one still pose with ::sprite{character=lorem pose=waving alt="…"} (see Sprite sheets).

A ```pixel fence or a ::pixel{gen=sprite seed=7 alt="…"} (or gen=noise) directive draws a pixel image on a card as a still SVG (its first frame), coloured by the theme tokens. A missing or blank alt is a pixel-alt warning with its line (an error under recit validate --strict) and leaves the image decorative. See Pixel for the grid, the legend and the attributes.

Text cards

:::textcard renders a card of text fitted to the frame: safe margins and a background around the content of an existing block (statement, title, stat or list), supported in webstory and motion in v1. A webstory card is compiled to static HTML, so the card uses the minimum size of its variant and nothing overflows; only a film's textcard block (and the React <TextCard>) picks, in the browser, the largest size that fits. Text exceeding the variant's character budget is an error with its line.

Markdowntextcards.story.md
--- id=headline :::textcard{variant=title background=gradient} # Dolor sit amet consectetur adipiscing ::: --- id=quote :::textcard{variant=quote background=theme} Lorem ipsum dolor sit amet, consectetur adipiscing elit. — Lorem Ipsum ::: --- id=figure :::textcard{variant=stat source="Lorem Ipsum report, 2026"} # 5,400 dolor sit amet this quarter :::
AttributeValuesDefaultMeaning
variantquote, title, stat, caption, listnoneRequired. Sets the dressed block and expected Markdown shape
backgroundtheme, gradientthemeTheme surface or a gradient of the theme colours
sourcestringnoneOrigin of a literal number; required when variant=stat, never translated
idstringnoneStable id of the card across languages
markstring, 40 characters at mostnoneA watermark (a handle, a site name) in the bottom corner, never translated

Each variant expects a closed shape: quote is one paragraph and an optional — attribution line; title is # Heading and an optional subtitle line; stat is # value and its label paragraph with source="…"; caption is one short paragraph; list is an optional heading and a bullet list of three to five items. Content outside that shape or an unknown attribute is an error with its line (examples/webstory-textcards).

The player

A tap on the first third goes back, anywhere else goes on; a long press holds the card; a swipe left or right changes card, a swipe up opens the call to action. The arrows, space (pause) and Escape do the same at the keyboard. A pause button is always visible (WCAG 2.2.2), the clock stops while the tab is hidden, and under reduced motion nothing plays by itself. ?card=3 or ?card=list opens a card.

A card with type=… is played by the block of a film, with the same props: it plays its entrance, then holds. A film becomes a story by changing format: motion to format: webstory.

The JSON twin

Every story has a typed JSON twin, kind: "story", validated by webstory.json. The settings are in settings, and each card holds its typed fields; cta is an object.

JSONlaunch.story.json
{ "$schema": "https://recit.dev/schema/v1/webstory.json", "kind": "story", "version": 1, "format": "webstory", "meta": { "title": "Lorem Launch", "lang": "en" }, "settings": { "autoplay": false, "dur": 5 }, "scenes": [ { "id": "hook", "background": "gradient", "body": "# Lorem ipsum." }, { "id": "cta", "background": "#1d1640", "body": "# Try it now", "cta": { "label": "Get started", "href": "https://recit.dev" } } ] }

recit convert launch.md --to json writes it, --to md writes the Markdown back.

Alongside scenes.id, scenes.body (see Scenes › In the JSON twin), scenes.dur and scenes.cta (cta.label, cta.href) shown above, settings.cover and each card in scenes accept:

KeyType / valuesEffect
settings.coverstring or { src, alt? }Round thumbnail of the story in a rail (and poster fallback for amp.html): a CSS color, "theme", "gradient", "pixel:<seed>" (the square texture), a media path, or an object.
cover.srcstringRequired when settings.cover is an object. Path, URL, color or keyword of the cover.
cover.altstring or Record<string, string>Optional localized text alternative of an image settings.cover.
scenes.typestring (non-empty)Motion block type playing the card ("title", "statement", "stat", "list"…).
scenes.propsRecord<string, unknown>Props object of the scenes.type block (parsed from the card's fenced YAML block in Markdown, in place of scenes.body).
scenes.holdnumber (>= 0)Extra seconds held after a motion block settles (hold= in Markdown).
scenes.accentstringAccent color of this card alone when played by a motion block (accent= in Markdown; ignored without scenes.type).
scenes.backgroundstring or { src, alt? }Card background: a CSS color, "theme", "gradient", "pixel:<seed>", an image or muted .mp4 / .webm video path, or an object with background.src and background.alt.
background.srcstringRequired when scenes.background is an object. Color, keyword, or image / video path of the card background.
background.altstring or Record<string, string>Optional localized text alternative of scenes.background (omitting alt on an image or video warns with webstory-missing-alt).
scenes.overlay"none" | "top" | "bottom" | "full"Readability gradient over the card background ("none" when omitted).
scenes.notesstring or Record<string, string>Optional author notes in Markdown (:::notes), hidden in the player and used as the voice-over of the film (Scenes).
scenes.attrsRecord<string, string | number | boolean>Optional separator attributes (--- key=value) not covered by a typed card field (Scenes).

Commands

CommandWhat it does
recit init --format webstorya Lorem story of four cards
recit dev launch.mdthe player, reloaded on every save (--variant <id> previews one row)
recit build launch.mda static player and its backgrounds (--variant <id> builds one row)
recit validate --strict launch.mdschema, density, alt, cta last, missing backgrounds, with lines
recit convert launch.md --to jsonthe JSON twin, and back with --to md
recit convert launch.md --to filmthe 9:16 film of the story, as film.json
recit convert calendar.md --to webstorythe next events of a calendar (Bridges)
recit convert report.md --to webstorythe figures of a report (Bridges)
recit export launch.md --to imagesone picture per card, or one folder per row with --variants (Images)
recit export launch.md --to images --preset instagram-storyone folder per social preset (instagram-story, tiktok, square…)
recit export launch.md --to images --all-localesthe same, one folder per language of i18n.locales
recit render launch.mdthe film of the story, or one MP4 per --preset (Film)

AMP version

recit build also writes amp.html, a standalone AMP Web Story linked from index.html through <link rel="amphtml">. It keeps the cards, their backgrounds (image, video, color; a pixel:<seed> texture becomes the theme fill), their headings and paragraphs, and the ::cta link. Motion blocks (type=…) and polls (:::form) are reduced to their text, with a webstory-amp-skipped warning at build time. Because AMP requires a poster and a publisher logo, the story needs an image cover, an image background on its first card, or a signature logo (brand.logo); without one, amp.html is skipped with a webstory-amp-no-poster warning.

Images

recit export launch.md --to images captures each card of the built player alone, at rest (?card=N&settled=1), in a 360×640 window at scale 3: one 1080×1920 PNG per card (1080×1350 in 4:5, 1080×1080 in 1:1), named 01-hook.png, 02-proof.png… and listed in exports.json.

  • --image-format jpeg or webp, --scale 2, --cards hook,cta (or the images settings).
  • --preset instagram-story,tiktok (instagram-post, square, linkedin-post… of MEDIA_PRESETS in @recit/core) captures one folder per preset at its exact size; listing them under images.presets (front matter, twin, or webstory.images.presets in recit.config.ts) captures those presets without --preset, and recit validate checks every card against them (webstory-safe-area warning when estimated text or the call to action falls under a covered margin, webstory-preset-aspect error when a preset is for another ratio, and chart-preset on a ::chart whose SVG text scales too small, overflows the card or crosses a safe area, raised to an error under --strict). The card checks are estimated without a browser; only the chart's text widths are measured in Chromium, in the story's theme font, when it is installed. Before each capture of a preset with a safe area, Chromium measures the tight bounding box of every text block and of the call to action on the settled card, and records any crossing as a safe-area warning in exports.json (warnings) and on the console; in recit dev, G (or the Safe area button) shades the same margins without touching the exported images or MP4.
  • --all-locales captures every language of i18n.locales, one folder each.
  • There is no PDF: recit export --to pdf on a story says to use --to images or recit render.
PresetSizeAspectSafe area (px)
instagram-story1080 × 19209:16top 250, bottom 340
tiktok1080 × 19209:16top 160, right 120, bottom 480
instagram-post1080 × 13504:5—
square1080 × 10801:1—
linkedin-post1080 × 10801:1—
linkedin-carousel1080 × 13504:5 (or 1:1)— (1080 × 1080 on a 1:1 deck)
og-image1200 × 628free—
mpu300 × 250free—
leaderboard728 × 90free—

The safe-area margins are documented starting values measured on the apps on 10 November 2026, not a promise from them: the apps move their buttons, and Récit updates the table with the date of each new survey.

Film

recit render launch.md renders a 9:16 film, one shot per card, through a closed mapping:

CardShot
type=… and its propsthe same block, the same props, and the card's accent
::chart or ::mapa still shot (styles flattened into the SVG; rise entrance for bar charts, fade else)
Markdownthe inference table of motion: a title alone, a quote, a list…
image background, no typea panel shot: the image, its headings and paragraphs as captions
color background, no texta panel shot of that color
color or pixel:<seed> under a shotthe theme of the film, with a warning
video backgrounda panel shot that plays the video, muted, for the card's duration
dur, hold, :::notesdur, hold, the voice-over
brand (inFilm: true)drawn on every shot (local logo embedded as a data: URI; omitted by default)
::ctalost (a link is not clicked in an MP4), with a warning

A card outside the table is an error with its line, never a guess: set type= on it.

Bridges

From → toHowOwned by
webstory → motionwebstoryToFilm of @recit/webstory/bridge@recit/webstory
motion → webstorymotionToWebstory of @recit/webstory/bridge@recit/webstory
calendar → webstorycalendarToWebstory of @recit/webstory/bridge@recit/webstory (the target)
report → webstoryreportToWebstory of @recit/webstory/bridge@recit/webstory (the target)
book → webstorybookToWebstory of @recit/webstory/bridge@recit/webstory (the target)
webstory → webtoonwebstoryToWebtoon of @recit/webstory/bridge@recit/webstory (the source)
glossary, directory → webstoryglossaryToWebstory, directoryToWebstory@recit/directory (the source)

Each bridge returns its diagnostics beside its result and never throws on a story it cannot read. A bridge owned by its target reads only the fields of the source model it needs, so the dependency goes one way: the exception written on the Bridges page next to the calendar and atlas ones.

To a film and back

TypeScriptTypeScript
import { webstoryToFilm, motionToWebstory } from "@recit/webstory/bridge"; const { film, diagnostics } = webstoryToFilm({ story, webstory }); // film is there only when no diagnostic is an error const { webstory: source, diagnostics: issues } = motionToWebstory(motionSource); // a film that is not 9:16, 4:5 or 1:1 is refused, never cropped: no webstory, a webstory-aspect diagnostic

From a calendar

recit convert calendar.md --to webstory tells the next events of a calendar as a story: a title card ("Coming up"), then one card per occurrence from the build day on, with its title, its date in the calendar's zone and language, its place and a ::cta to its page when it has a url. Five cards of events at most, a warning names the ones left out. A cancelled occurrence is skipped, the description of an event does not cross (a card never summarises), and a calendar with nothing ahead is an error that writes nothing. -o coming-up.json writes the story's twin instead of Markdown.

From a report

recit convert report.md --to webstory tells the figures of a report: a title card, then, in the order of the report, one card per item of a :::kpi (its :value as a heading, its label under it) and one card per ::chart. The data directives cross as they are, with the data: of the report, its paths rewritten from the folder of -o: the story computes its numbers at build time, like the report. Prose, tables and callouts do not cross (a warning per section); a report with no figure, or a :::kpi item without :value, is an error that writes nothing.

A story of the webstory format reads its own data: the same way: :value, ::chart, ::table, :::kpi and ::map work in any card, drawn at the card's own social layout (story for 9:16, portrait for 4:5, square for 1:1) so axis and marker labels stay legible on a phone without CSS zoom (past 6 bars or 3 series, compilation warns with data-legibility, and recit validate checks each ::chart against the target presets as chart-preset).

From a book

recit convert book.md --to webstory tells a book as cards (bookToWebstory): a title card (the title, the author, the description), then one card per chapter, in the order of the book. Each card shows the chapter's number (« Chapter 2 », in the book's language, the part before it), its title, and its opening as a quote: the :::epigraph of its first section with its source, else the first sentence of its first paragraph, cut at a word past 180 characters. A chapter outside the numbering (a preface) shows no number. The rest of the chapter does not cross: a card never summarises. A chapter with nothing to quote keeps its title alone, with a warning; a book with no chapter is an error that writes nothing; past 29 chapters, the story keeps the first ones and warns. --locale fr tells the French book, as recit build does.

To a webtoon

recit convert story.md --to webtoon -o episode.md (webstoryToWebtoon) turns a web story into a webtoon episode, read from top to bottom: one panel per card, with the card's id, attributes and notes. The background of the card becomes the image of the panel, with its description, or its colour; a theme keyword leaves the episode's own background. Each heading, paragraph, quote or list item of the card becomes one caption, stacked at the top of the panel, its emphasis kept; a :::dialogue{cast mood} becomes a bubble of its speaker in the same stack, its shape the mood when the mood names one (thought, shout, whisper). A card a panel cannot hold (a block with data, a directive such as ::chart, a table, code, an image in the text) is an error with its line, and nothing is written; the call to action, a video background and the targets of links are left out, each with a warning. The images are written from the folder of -o, and -o episode.json writes the episode's twin.

From a glossary or a directory

recit convert glossary.md --to webstory (or a directory) writes one card per term or entry, up to 30 cards, with the same { source, diagnostics } result (glossaryToWebstory and directoryToWebstory of @recit/directory).

Packages

@recit/webstory, in the 1.0 contract, has four subpaths: . (the model: storyToWebstory, the settings and the budget), ./components (the player and its cards, with ./styles.css), ./bridge (the bridges above) and ./runtime (the browser runtime of the built player).

In a page

In a Récit site, a story of the stories folder gets its player as its page, and a page embeds it:

MDXMDX
<StoryEmbed slug="launch" format="webstory" />

On the fullscreen page of a site (publish.layout: "none"), a "Back to the site" link opens the player's controls, before its buttons and over the card, so the card keeps the whole screen; it leads to the site's home in the story's language. An embedded story has none. Outside a site, StoryPlayer takes the same link as home: { href, label }.