图书格式

Validation and versions

What the validator checks, and how format versions keep books readable.

规范正文为英文。

Rules the validator checks

Beyond the schemas:

  1. Every section file named in book.json exists, and the cover exists.
  2. Every asset path (audio, src, image) points to a file in the package. Full https:// URLs are allowed but not recommended: books must work offline.
  3. Every localized map contains the base locale.
  4. Block ids are unique in each section file.
  5. Exercise answers match their prompts (Exercises).
  6. Passage words appear in their sentence in order and name a sense in lexicon.json; sense ids are unique and their audio exists.
  7. Example parts use a known role and appear in the line in order.
  8. Japanese books follow the furigana rules.

Run it from the starter kit:

pip install jsonschema
python3 validate_books.py path/to/my-book

Versions and compatibility

  • schema changes only for breaking changes. A reader that knows schema 2 cannot open schema 3.
  • formatVersion (feature level) rises by one whenever a block kind, text mark or exercise type is added. Ledu works out the lowest level each book needs when it is published, so a book that uses nothing new stays readable on older app versions. Level 1 is everything not listed below; level 2 adds passage; level 3 adds furigana; level 4 adds public paid-book samples; level 5 adds Chinese verse blocks; level 6 adds literature style presets; level 7 adds opening vertical title/chapter columns with independent font sizes; level 8 adds edition-localized modern notes following each verse; level 9 adds a native notes seal; level 10 adds verse.sourceForms so subtitles follow the transcription toggle.
  • A block kind the reader does not know is shown as a short “needs a newer version” note; the rest of the section still reads.
  • Unknown fields are ignored, so a "$schema" key pointing at the schema URL is allowed (and lets editors such as VS Code check the file as you type).