# Webtoon

<StatusBadge status="available" /> `format: webtoon` turns a story into a **webtoon
episode**: a vertical strip of **panels** read by scrolling. Every scene is a panel, an image and
its **lettering** (bubbles, captions, sound effects), written as text so it stays selectable,
searchable by the site and translatable.

The syntax, its JSON twin and the reader of `@recit/webtoon` are ready: `recit dev`, `recit build`,
`recit validate`, `recit convert` and `recit i18n check` read an episode, and a Récit site publishes
it, `recit export --to pdf` prints it ([PDF](#pdf)) and `recit render` turns it into a 9:16 film
([Film](#film)), and `recit export --to images` cuts it into slices for the platforms
([Slices](#slices)).

## A minimal episode

```md title="episode-1.md"
---
title: Lorem Ipsum — Episode 1
lang: en
format: webtoon
width: 800
gutter: 120
background: "#101014"
---

--- id=p1 src=./panels/01.webp alt="A lorem street at night, under a single lamp."

:::caption
Somewhere, dolor sit amet.
:::

:::bubble{x=62% y=18% tail=bottom-left cast=lorem}
Lorem *ipsum*?
:::

--- id=p2 src=./panels/02.webp alt="Two ipsum figures, close up." height=1400 gutter=40

:::bubble{x=30% y=12% shape=shout}
Ipsum!
:::

:::sfx{x=70% y=60% rotate=-12}
BOOM
:::

:::notes
Author note, never published. The voice-over of the film.
:::

--- id=p3 background=#000000

:::caption{x=50% y=50% w=60%}
The end, for now.
:::
```

`examples/webtoon-episode` is a whole episode in English and French: every bubble shape, captions,
sound effects, a colour panel and a tall one.

## Settings

The settings sit at the root of the front matter. In `recit.config.ts` they are the `webtoon:`
section, the defaults of every episode of the folder (the front matter wins).

| Key          | Value                                                                           | Default            |
| ------------ | ------------------------------------------------------------------------------- | ------------------ |
| `width`      | reference width of the strip, in px                                             | `800`              |
| `gutter`     | space after each panel, in px                                                   | `120`              |
| `background` | colour of the gutters and of the page around the strip                          | the theme's        |
| `font`       | a font role of the theme (`lettering`, `sans`) or a named variant (`lexend`)    | `lettering`        |
| `direction`  | `ltr` or `rtl`: sets `dir` only, the Markdown order is the reading order        | `ltr`              |
| `budget`     | `panelBytes` and `episodeBytes`: a warning over them                            | none               |
| `pacing`     | `maxPanelBubbles` and `maxBubbleWords`: a warning over them ([Pacing](#pacing)) | `2` and `25`       |
| `pdf`        | options of the PDF: `pagination`, `pageHeight`, `maxBytes` ([PDF](#pdf))        | `1280px` pages     |
| `images`     | options of the slices: `preset`, `width`, `sliceHeight`… ([Slices](#slices))    | 1280 px PNG slices |

### Pacing

`recit validate` warns about a panel with more than two `:::bubble` blocks (`webtoon-dense-panel`)
and a bubble of more than 25 words (`webtoon-long-bubble`). An episode, or every episode of the
folder through `webtoon.pacing` in `recit.config.ts`, can set other thresholds:

```yaml
---
format: webtoon
pacing:
  maxPanelBubbles: 3
  maxBubbleWords: 30
---
```

The options `--max-panel-bubbles` and `--max-bubble-words` win over the front matter, which wins
over `recit.config.ts`; the defaults come last.

`font: lettering` reads the `--recit-font-lettering` role token, which defaults to the theme's body
font (`--recit-font-sans`); set `theme.fonts.lettering` in `recit.config.ts` (or in the episode's
`theme:`) to pick another stack.

`webtoon.pdf.pagination` is `panels`, the only value: pages of `pageHeight` cut between two panels.
The same keys, nested, are the `settings` of the JSON twin. The former `toon:` section is read as
`webtoon:` with a warning until 1.0 ([Former name](#former-name)).

### Panels

The separator line `--- id=…` opens a panel.

| Attribute    | Role                                                                                               |
| ------------ | -------------------------------------------------------------------------------------------------- |
| `id`         | required and unique: the key of translations and companions                                        |
| `src`        | the image, next to the story (WebP or AVIF recommended) or a URL; its size is read from its header |
| `alt`        | required with `src`: what the image shows, for screen readers                                      |
| `height`     | height at the reference width, in px, without an image or to crop                                  |
| `gutter`     | space after this panel, in px                                                                      |
| `background` | a plain colour panel                                                                               |

A panel with neither `src` nor `background` is a **placeholder**: the reader draws a frame with its
`id` (and its `prompt=`) until the image exists. Récit never generates an image. The attributes
`beat`, `cast`, `set`, `shot`, `pose` and `prompt` are reserved for the
[scenario](/documentation/scenario/overview) and kept as they are.

### Lettering

The body of a panel holds **only** `:::bubble`, `:::caption`, `:::sfx`, `::character` and
`:::notes`. Anything else, a paragraph, a heading or an image, is an error with its line. The order
of the directives is the reading order.

| Directive    | Attributes                                                                                                                                              |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `:::bubble`  | `x`, `y` (centre, in % of the panel), `w` (maximum width, default 40 %), `tail`, `shape` (`speech`, `thought`, `shout`, `whisper`), `cast` (who speaks) |
| `:::caption` | `x`, `y`, `w`                                                                                                                                           |
| `:::sfx`     | `x`, `y`, `rotate` (degrees, -180 to 180), `size` (`s`, `m`, `l`, `xl`), `narrative` (read by screen readers; hidden otherwise)                         |
| `:::notes`   | none: never shown, the voice-over of the film                                                                                                           |

A tail points `bottom-left`, `bottom`, `bottom-right`, `top-left`, `top`, `top-right`, `left`,
`right` or `none`. Without `x` and `y`, the lettering is stacked at the top of the panel. A bubble
grows with its text up to `w`; an overflow of the panel is a warning, per language. The text is
inline Markdown, emphasis only. `cast` names the speaker for a screen reader, which cannot see the
tail.

A `speech` or `whisper` bubble is a pill: its ends are half circles on one line of text, and stay
rounded corners of 1.5 em on a longer text (dotted for `whisper`); `thought` is a cloud and `shout`
a burst. A film's `panel` block draws the same shapes.

### Characters in a panel

An episode whose front matter names a bible with `cast:` can place one or more character layers over
the background of a panel and under its lettering (preview, `@recit/character`, an optional
package):

```md
--- id=p1 height=1000 background=#101014

:::bubble{x=64% y=20% tail=bottom-left cast=lorem}
Lorem *ipsum*!
:::

::character{character=lorem pose=waving expression=joy x=32% y=72% h=60% alt="Lorem waves."}
```

`pose=` and `expression=` give the posture, or `animation=` draws the first image of a cycle;
`render=` picks a `vector` render and `variant=` a variant. `x` and `y` place the centre of the
layer in percent of the panel (`50%` and `50%` when omitted), `h` sets its height in percent of the
panel (`60%` by default), and `alt` overrides its accessible name (default, « name, pose »). In the
JSON twin, the layers live in `characters` on the scene. In the film (`recit render`), each
character plays its animation in the panel's shot, and `@recit/character` must be installed.

### Languages

`episode-1.fr.md` is the same episode in French: the same panels, ids, images and positions, the
texts translated. `recit i18n check` keeps it in step: the same number of lettering elements, the
same types and positions, and a warning (an error with `--strict`) on a text left untranslated. A
partial translation goes in a companion, `episode-1.fr.json` (`kind: "sidecar"`), which completes
panels by their `id`.

In a site, each language has its page, a selector on the strip and the `hreflang` alternates.

## The JSON twin

The typed twin (`kind: "story"`) is validated by
[`webtoon.json`](https://recit.dev/schema/v1/webtoon.json). The settings are in `settings`, and each
panel holds its `lettering` in one array, in reading order. A text holds every language.

```json title="episode-1.json"
{
  "$schema": "https://recit.dev/schema/v1/webtoon.json",
  "kind": "story",
  "version": 1,
  "format": "webtoon",
  "meta": { "title": "Lorem Ipsum — Episode 1", "lang": "en" },
  "settings": { "width": 800, "gutter": 120 },
  "scenes": [
    {
      "id": "p1",
      "src": "./panels/01.webp",
      "alt": { "en": "A lorem street at night.", "fr": "Une rue lorem la nuit." },
      "lettering": [
        { "type": "caption", "text": "Somewhere, dolor sit amet." },
        { "type": "bubble", "x": 62, "y": 18, "tail": "bottom-left", "text": "Lorem *ipsum*?" }
      ]
    }
  ]
}
```

Percentages are numbers from 0 to 100 in JSON and are written with `%` in Markdown.
`recit convert episode-1.md --to json` gives the twin, `--to md` the canonical Markdown back, byte
for byte.

| Key                 | Type / values                                 | Effect                                                                                                                                                   |
| ------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scenes.id`         | `string` (non-empty)                          | Required. Panel identifier, stable across languages (`--- id=…`).                                                                                        |
| `scenes.src`        | `string`                                      | Optional image path relative to the story or URL; `scenes.alt` holds its localized description (`string` or `Record<string, string>`).                   |
| `scenes.height`     | `integer` (`> 0`)                             | Optional panel height in pixels at the reference `width` (defaults to the scaled height of `scenes.src`); `scenes.gutter` (`>= 0`) sets the space below. |
| `scenes.background` | `string`                                      | Optional colour of a panel without an image (`--- background=…`).                                                                                        |
| `scenes.lettering`  | `WebtoonLettering[]`                          | Optional `bubble`, `caption` and `sfx` items in reading order.                                                                                           |
| `scenes.characters` | `WebtoonCharacter[]`                          | Optional character layers (`::character{…}`, preview), drawn over the background and under `scenes.lettering`.                                           |
| `scenes.notes`      | `string` or `Record<string, string>`          | Optional author notes (`:::notes`), hidden in the reader and spoken as the shot's voice-over in `recit render`.                                          |
| `scenes.attrs`      | `Record<string, string \| number \| boolean>` | Optional separator attributes (`--- key=value`) other than `id`, `src`, `alt`, `height`, `gutter` and `background` (`beat`, `cast`, `set`, `prompt`…).   |
| `scenes.body`       | `string` or `Record<string, string>`          | Never valid panel content: holds stray non-lettering Markdown during conversion so `recit validate` reports `webtoon-body-content` without losing text.  |

On a page of its own (`recit dev`, `recit build`, the fullscreen page of a site), the reader opens
with the episode's title as the page heading, its place in a series and the folded summary of the
panels, on one band of the interface. On the fullscreen page of a site, a "Back to the site" link
above the title leads to the site's home in the episode's language. Inside a site's page, which has
its own title, it shows the summary alone. A printed or sliced strip has neither.

## Commands

| Command                                                         | Effect                                                          |
| --------------------------------------------------------------- | --------------------------------------------------------------- |
| `recit init --format webtoon`                                   | a Lorem episode of three panels, with placeholders              |
| `recit dev episode-1.md`                                        | the reader, reloaded when the story or an image changes         |
| `recit build episode-1.md`                                      | a static reader, its images copied, the budget checked          |
| `recit validate --strict episode-1.md`                          | schema, lettering, missing images, budget and `alt`, with lines |
| `recit convert episode-1.md --to json`                          | the twin, and `--to md` back                                    |
| `recit i18n check`                                              | the parity of every language                                    |
| `recit export episode-1.md --to pdf`                            | the PDF, cut between panels, listed in `exports.json`           |
| `recit render episode-1.md`                                     | a 9:16 MP4, one shot per panel ([Film](#film))                  |
| `recit export episode-1.md --to images --preset webtoon-canvas` | the slices of a platform ([Slices](#slices))                    |
| `recit convert episode-1.md --to film`                          | the 9:16 `film.json` of the episode ([Bridges](#bridges))       |
| `recit migrate episode-1.md`                                    | rewrites `format: toon` as `format: webtoon`                    |

An agent reads the same rules through the MCP server: `describe_format` with `webtoon`, and the
resource `recit://guide/webtoon`.

### PDF

`recit export episode-1.md --to pdf` prints the reader: pages as wide as the strip and `pageHeight`
high, cut between two panels and never inside one. The space left at the bottom of a page takes the
colour of the gutters. A panel taller than a page gets a page of its own height, with a warning.
Raster images other than JPEG (PNG, WebP, AVIF) are printed from a JPEG variant, so the file stays
light; an SVG stays vector. One PDF per language: export `episode-1.fr.md` for the French one.

```yaml
pdf:
  pageHeight: 1280px # any print length: 297mm, 11in…
  maxBytes: 4000000 # weight budget: a warning over it
```

`--strict` turns the warnings (over the budget, a panel on a page of its own) into an error. The PDF
is tagged; a panel without `alt` is silent in it, which `recit validate` already reports.

### Slices

`recit export episode-1.md --to images` cuts the reader into slices of fixed height, lettering
included, for the platforms that take an episode as a series of images. The strip is scaled to the
width of the slices and captured one slice at a time, then encoded by Chromium: no image of the
whole episode is ever held in memory. `--all-locales` cuts every language of `i18n.locales`, one
folder each, and the slices are listed in `exports.json` with their number.

| Preset           | Width  | Slice   | Format | Per slice | Per episode       | Checked    |
| ---------------- | ------ | ------- | ------ | --------- | ----------------- | ---------- |
| `webtoon-canvas` | 800 px | 1280 px | JPEG   | 2 MB      | 20 MB, 100 slices | 2026-11-03 |
| `tapas`          | 940 px | 2000 px | JPEG   | 10 MB     | no limit stated   | 2026-11-03 |

The platforms change their limits: each preset carries the date it was checked and the guide it
comes from (`WEBTOON_IMAGE_PRESETS`). To show the cuts before exporting, `SlicedStrip` of
`@recit/webtoon/components` draws the strip with a line at each cut of a preset and the preset's
sizes in its caption. A slice over its weight, or an episode over the preset's count or weight, is a
warning. The flags override the preset, and so does the `images` setting of the episode or of
`webtoon:` in `recit.config.ts`:

```yaml
images:
  preset: webtoon-canvas
  sliceHeight: 1000 # px
  format: webp # png, jpeg or webp
  quality: 0.85 # JPEG and WebP, 0 to 1
  maxBytes: 1500000 # a warning over it
  avoidLettering: true
```

A platform joins the slices with no seam, so a cut through a bubble does not show: the height is
fixed by default. `avoidLettering` (`--avoid-lettering`) moves a cut up above the bubble, caption or
sound it would cross, by at most a third of a slice.

### Film

`recit render episode-1.md` renders the episode as a vertical film (`9:16`), through the same
renderer as a [motion](/formats/motion/overview) story. The mapping is closed: one panel, one shot
of the `panel` block.

| Panel                   | Shot                                                                       |
| ----------------------- | -------------------------------------------------------------------------- |
| `src` and its size      | the image fills the width and pans from the top to the bottom of the panel |
| lettering, in order     | appears one element after the other, with the shapes of the reader         |
| `:::notes`              | the voice-over of the shot                                                 |
| `dur=` on the separator | the length of the shot; else the reading time of its text, plus `hold=`    |
| `background`, no image  | a plain colour shot                                                        |
| placeholder panel       | an error: there is no film without its images                              |

In a site, `<StoryEmbed slug="episode-1" format="motion" />` plays the same film.

### Series

A folder of episodes is a series when it holds a `series.json` (`kind: "series"`), validated by
[`series.json`](https://recit.dev/schema/v1/series.json): the title of the series, its cover and the
order of its episodes. Each episode stays a story of its own, with its twin and its languages.

```json title="series.json"
{
  "$schema": "https://recit.dev/schema/v1/series.json",
  "kind": "series",
  "version": 1,
  "format": "webtoon",
  "title": "Lorem Ipsum Shorts",
  "episodes": ["episode-1.md", { "file": "episode-2.md", "title": "Ipsum, the second" }]
}
```

A published episode of a series ends with the links to the previous and the next episode, in its
language. An episode missing from the list, or a listed file that does not exist, is an error that
names the series. `examples/webtoon-series` holds two short episodes and their series.

| Key              | Type / values                        | Effect                                                                                                                                       |
| ---------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `version`        | `1`                                  | Required alongside `kind: "series"`, `format: "webtoon"`, `title` (localized) and `episodes`.                                                |
| `description`    | `string` or `Record<string, string>` | Optional localized summary of the series.                                                                                                    |
| `cover`          | `string`                             | Optional cover image path relative to `series.json`.                                                                                         |
| `episodes`       | `Array<string \| { file, title? }>`  | Required (at least one entry, each file listed once): relative `.md` or `.json` story paths in reading order, or objects overriding a title. |
| `episodes.file`  | `string`                             | Required on an object entry: story file path relative to `series.json`.                                                                      |
| `episodes.title` | `string` or `Record<string, string>` | Optional navigation label for that episode (defaults to the episode's own `title`).                                                          |

## Bridges

| From → to        | How                                        | Owned by         |
| ---------------- | ------------------------------------------ | ---------------- |
| webtoon → motion | `webtoonToFilm` of `@recit/webtoon/bridge` | `@recit/webtoon` |

`recit render` and `recit convert --to film` go through it: one panel, one `9:16` shot of the
`panel` block ([Film](#film)). Like every bridge, it returns its diagnostics beside its result and
never throws on an episode it cannot read. The [Bridges](/formats/bridges) page lists the others.

```ts
import { webtoonToFilm } from "@recit/webtoon/bridge";

const { film, diagnostics } = webtoonToFilm(webtoon, { file: "episode-1.md" });
// film is there only when no diagnostic is an error: a placeholder panel is one
```

## Former name

The format was called `toon` before. Until 1.0, `format: toon` (front matter, twin, `series.json`),
the `toon:` section of `recit.config.ts`, `--format toon` and `recit schema toon` of the CLI, and
the MCP guide `recit://guide/toon` are still read as `webtoon`, each with a warning
(`deprecated-format-id`) that names the new spelling. `recit migrate` rewrites `format: toon` in the
stories (Markdown, twin, `series.json`), and a twin's `$schema` that names `schema/v1/toon.json`;
rename the `toon:` section, the CLI option and the MCP address by hand. The package `@recit/toon`
was never released: install `@recit/webtoon`.

## In a page

A published episode has its page, and it shows inside another page with:

```mdx
<StoryEmbed slug="episode-1" format="webtoon" />
```
