Book format

The manifest

book.json: the book's identity, languages and table of contents.

{
  "schema": 2,
  "meta": {
    "id": "c7a8a5e2-3f0b-4c39-9a51-0f3c2d6b1e10",
    "name": "spanish-first-steps",
    "displayName": { "en": "Spanish · First Steps" },
    "subtitle": { "en": "Greetings and introductions" },
    "cover": "cover.png",
    "type": "course",
    "access": "free",
    "direction": "ltr",
    "language": { "target": "es", "base": "en" },
    "level": "A1",
    "version": "1.0.0"
  },
  "features": { "flashcards": true },
  "chapters": [
    {
      "id": "sfs-l01",
      "name": "lesson-1",
      "title": { "en": "Lesson 1 · Hola" },
      "group": { "id": "u1", "name": "unit-1", "title": { "en": "Unit 1 · Meeting people" } },
      "sections": [
        { "id": "sfs-l01-learn", "name": "learn", "title": { "en": "Learn" }, "file": "lessons/lesson-1-learn.json", "audio": true },
        { "id": "sfs-l01-practice", "name": "practice", "title": { "en": "Practice" }, "file": "lessons/lesson-1-practice.json" }
      ]
    }
  ]
}

Top level

Field Required Meaning
schema yes Always 2.
meta yes What the book is (below).
sections or chapters exactly one The table of contents. A flat list of sections, or chapters that each hold sections. Never both.
features no Optional reader features, each false when absent: flashcards lets readers save words to their own review decks; titleOnlyHeader shows only Back and the title in the reader header.
style no Optional book styling. literature supplies named reader presets for verse blocks; blocks defines the book’s own looks for any block kind (both below).
formatVersion no Written by Ledu at publish time (versions). Leave it out.

Literature styles

Feature level 6 supports native frames and writing rules, with no background images or CSS. Store presets in book.json; they travel with every normal edition or sample download. Readers choose a preset in Reading style. That choice is saved per edition independently of original/simplified text and horizontal/vertical layout. An unset or removed choice uses the publisher’s default preset. Books without these presets keep their existing rendering.

"style": {
  "literature": {
    "default": "classic",
    "presets": [{
      "id": "classic",
      "name": {"zh-Hans": "古籍双框", "zh-Hant": "古籍雙框"},
      "font": "serif", "fontSize": 26, "columnSpacing": 1.55,
      "lineSpacing": 12, "stanzaSpacing": 24, "contentInset": 18,
      "metadata": "leading", "titleFontSize": 34, "chapterFontSize": 18,
      "border": {"outerWidth": 2, "innerWidth": 0.5, "gap": 5, "radius": 0},
      "rules": {"width": 0.5, "opacity": 0.6},
      "colors": {
        "light": {"paper": "#F9F5E9", "ink": "#24221D", "decoration": "#A79A83"},
        "dark": {"paper": "#24231F", "ink": "#EDE6D5", "decoration": "#9D927F"}
      }
    }]
  }
}

default must name one of 1–20 presets; ids are unique lower-case slugs. Every preset needs id and a localized name including the edition’s base locale. Other fields are optional:

Field Values / range Default
font system, serif, rounded, monospaced system
fontSize 12–48 points, scaled by the reader’s text size and Dynamic Type 22
titleFontSize, chapterFontSize Opening vertical heading: 12–72 / 10–48 points, scaled by Dynamic Type (feature level 7) 1.3 × / 0.7 × fontSize
notesFontSize Modern notes: 10–32 points, capped at 0.85 × body size, scaled by Dynamic Type (feature level 8) 0.7 × fontSize
notesSeal One character in a native red seal beside the notes heading horizontally, above it vertically (feature level 9) none
columnSpacing 1.15–3 × font line height 1.45
lineSpacing, stanzaSpacing 0–40 / 0–80 points 8 / 24
contentInset 8–48 points; increased as needed to clear the border 18
metadata above, side (vertical title/source at lower left), leading (opening vertical column, feature level 7) above
border outerWidth, innerWidth: 0–6; gap: 2–16; radius: 0–32 points No frame; omitted widths 0, gap 5, radius 0
rules width: 0–3 points; opacity: 0–1 No rules; inside a rules object: width 0.5, opacity 0.55
colors Optional light, dark, sepia objects, each with optional paper, ink, decoration in #RRGGBB Reader theme colours

Rules separate vertical columns or underline authored horizontal lines. Long vertical passages scroll horizontally from the right; their characters and stanza breaks remain intact. Side metadata moves above/below at accessibility text sizes or on narrow panels. Missing colour fields use the reader theme, including system dark mode. paper fills both the content block and the surrounding reading area, including the bottom safe area, for one continuous background. Fonts use available system families; unavailable Chinese serif fonts fall back to the platform’s Chinese glyphs. Use a preset without border and rules for an undecorated alternative. Add further presets in a book update without changing the app; new rendering capabilities still require an app/format update.

With metadata: "leading", the verse title and its source/chapter share the first, rightmost column, using titleFontSize and chapterFontSize. One full blank column separates them from the poem. The heading scrolls with the text and wraps into more columns if needed at large text sizes; no characters are clipped. The duplicate reader title above the controls is hidden in this vertical layout. Horizontal layout keeps its title above the poem and source below it.

Book colours

A book can set its own colours for each reading theme under style.palette. The reader still chooses the theme; the book says what that theme looks like in this book.

"style": {
  "palette": {
    "light": { "accent": "#8A4B2A", "accentTint": "#F6E9DD", "bg": "#FFFBF5" },
    "dark":  { "accent": "#D9A27E", "accentTint": "#3A2A20" }
  }
}

Each of light, dark and sepia maps a colour name to #RRGGBB. Names: bg (page), surface (cards and boxes), textPrimary, textMuted, accent, accentDark, accentTint, accentDeep. A name the book leaves out keeps Ledu’s colour. Sepia without its own set uses light; dark without its own set keeps Ledu’s colours, so a book that only sets light stays readable at night. Check that text colours stay readable on the backgrounds you choose in every theme you set.

The colours apply to the whole book: the page, headings, cards and every block. A block preset (below) can change them again for one kind of block. A reader that does not know palette shows Ledu’s colours, so it needs no higher formatVersion.

Text styles

A book can restyle its text under style.roles: a role name, then what to change. Anything the book leaves out keeps Ledu’s look.

"style": {
  "roles": {
    "body":      { "size": 18, "lineHeight": 1.5 },
    "h2":        { "size": 26, "color": "@accentDeep" },
    "caption":   { "italic": true },
    "secondary": { "size": 15, "weight": "medium" }
  }
}
Field Meaning
size Point size at the standard text size, 8–72. It grows and shrinks with the reader’s text-size setting and the device’s Dynamic Type size.
weight regular, medium, semibold or bold.
italic, mono, underline true to set the text in italics, in a fixed-width face, or underlined.
lineHeight Line height as a multiple of the size, 1–2.5.
color #RRGGBB, or @ and a colour name from Book colours. A plain #RRGGBB is the same in every theme; prefer a colour name.
lockSize true keeps the size fixed whatever the reader’s text size. Use sparingly: it works against readers who need larger text.
lockColor true keeps the colour as in the light theme in every theme.

Roles that set the size and face of text:

Role Used for Ledu’s size
h1, h2, h3 heading blocks 28, 22, 18
body text blocks and explanations 16
sectionTitle the largest titles inside a block 22, bold
title card and block titles 20
number large numbers 20
label bold labels and small headings 17, semibold
control buttons and tappable labels 15, semibold
line lines of text inside cards, lists and tables 15
secondary supporting lines, such as a translation under a sentence 13
caption captions and small labels 12
fine the smallest print 11

These last nine are a scale shared by every block: changing secondary changes every supporting line in the book, whichever block it sits in.

Roles that set a colour (color, lockColor): the ones above, and quote, link, highlight, target, gloss, pron, speaker, marker, example, instruction, componentTitle, tableHeader, tableRowAlt, the vocabulary card (vocabCardBg, vocabPanelTop, vocabPanelBg, vocabCurrentBg, vocabBorder, vocabWord, vocabPron, vocabGloss), the code block (codeText, codeFile, codeLang) and exercise cards (exerciseCard, exerciseSelected, exerciseCorrect, exerciseWrong, exerciseRevealed).

Limits today: most target-language text (sentences, words, letters) is drawn at Ledu’s own sizes and does not yet follow size; a book cannot yet bring its own typeface. Text styles never change a block’s layout. A reader that does not know roles shows Ledu’s look, so they need no higher formatVersion.

Block presets

A book can define its own looks for any block kind under style.blocks: the kind, then a preset name. A block uses one by naming it in its style. The name default applies to every block of that kind that names no style (or one that is not defined).

"style": {
  "blocks": {
    "callout": {
      "default": { "colors": { "light": { "accent": "#8A4B2A", "accentTint": "#F6E9DD" },
                               "dark":  { "accent": "#D9A27E", "accentTint": "#3A2A20" } } },
      "warm":    { "frame": { "background": "@accentTint", "border": "@accent", "radius": 12 } }
    },
    "box": { "ruled": { "look": "double" } }
  }
}
Field Meaning
look A built-in style of the kind to draw with (such as double for box).
colors light, dark and sepia sets; each maps a colour name to #RRGGBB. Names: bg, surface, textPrimary, textMuted, accent, accentDark, accentTint, accentDeep. Sepia without its own set uses light; dark without its own set keeps Ledu’s colours.
frame A panel around the block: background and border (#RRGGBB or @ and a colour name), borderWidth 0–4, radius 0–32, padding 0–32.

Blocks inside a container (a box, callout or collapsible) are drawn in the container’s preset colours; a nested block’s own preset replaces only the colours it names. A frame and a style name apply to their own block only.

Presets change colours and the frame only, never the block’s layout or content. A reader that does not know presets shows the default look, so they need no higher formatVersion. Some blocks still draw part of themselves in fixed colours that colors does not reach.

meta

Field Required Meaning
id yes Permanent unique id, 8+ characters. Use a UUID; never change it.
name yes Package name: lower case, digits and hyphens (^[a-z0-9-]+$). Same as the folder name.
displayName yes Localized title.
subtitle no Localized subtitle.
cover yes Path to the cover image.
editionCovers no Authoring-only map such as {"zh-Hans":"cover-sc.png","zh-Hant":"cover-tc.png"}. Every published edition must have an entry when this map is present. Publishing sets cover to that image and removes the map and unused artwork; the default cover remains required in the master package.
thumbnail no Path to a smaller cover. Ledu makes sized copies of the cover itself, so this is rarely needed.
type yes course (lessons), syllabary (a kana-style chart book), positionalScript (letters that change shape by position, such as Arabic or Persian), reference (look-up material).
access yes free or paid. Sections can override it (below).
direction yes Reading direction of the target language: ltr or rtl.
language.target yes BCP-47 code of the language taught: es, ja, fa, ar …
language.base yes Locale code of the explanations: en, zh-Hans … Every localized map must contain it.
version no Semantic version of this edition (1.0.0). Raise it for every new upload.
level no CEFR-style level, such as A1.
seriesGroup no Series name, to group the book with its siblings.
category, tags no Free strings for the catalogue.
publishedAt, sku no Set by Ledu when the book is published. Leave them out.

Section reference (inside sections or a chapter’s sections)

Field Required Meaning
id yes Unique in the book, stable across versions.
name yes Short slug, such as listen.
title yes Localized.
file yes Path to the section file. No #.
audio no true when the section has audio (the reader then offers playback controls).
icon no Name of an icon.
preview no true makes the section readable before a paid book is bought.
access no free or paid, overriding the book.
video no Reserved.

Chapter

Field Required Meaning
id, name, title yes As for a section.
sections yes Section references.
group no {id, name, title}: the unit this chapter belongs to. Consecutive chapters with the same group id are shown together.
access no free or paid for the whole chapter.
available no false shows the chapter as coming soon.
icon, downloadable, hasVideo no Reserved.