Docs / Import and export

Course import/export - the single-file format

The single file (.lilychess-course.md) is the recommended format to have an AI review, edit or write a course: one UTF-8 text file (20 MB maximum) containing the whole course. Export it from the Settings tab of a course; import it from the course list (new course) or update an existing course from the same Settings tab. The exported file starts with a built-in help text that is ignored when the file is read.

Structure

  1. First line, exactly: <!-- lilychess:course v1 -->
  2. The course header, between two --- lines (front matter): title (required), description, baseLang, title_<code>, description_<code>, visibility, acceptMode, exportMode, exportedVersion, exportedAt, generator, courseId.
  3. Free text (the help) that is ignored when reading.
  4. A series of blocks, each introduced by a separator line alone on its line:
    • <!-- lilychess:module --> starts a module; its pages follow;
    • <!-- lilychess:page --> starts a page of the current module;
    • <!-- lilychess:resource --> starts an embedded resource (at the end of the file, after all pages).

Each block starts with front matter between two --- lines, followed (for a page or resource) by the content up to the next separator. A module has no content.

<!-- lilychess:course v1 -->
---
title: Classical openings
description: Three openings to know.
courseId: 8f3c2a10-...
---

<!-- lilychess:module -->
---
key: italian
title: The Italian Game
id: 3a3d382f
---

<!-- lilychess:page -->
---
key: main-ideas
title: Main ideas
id: 36192a39
baseHash: 8a5d9b91...
---
# Main ideas

See also [[page:plans]].

::diagram{id="d1" moves="1. e4 e5 2. Nf3 Nc6 3. Bc4" label="Italian Game"}

Fields

  • Module: title (required), title_<code>, preview (true or false, see free preview; absent means the default rule), key, id.
  • Page: title (required), title_<code>, key, published, id, baseHash.
  • Languages (<code> is one of fr, en, es, ru, he): baseLang: en sets the course base language; title_fr: Ouvertures (or a multi-line description_fr: |) sets a translated text. These are flat keys (no nesting); older readers ignore them. An unknown code or a title over 200 characters is refused (LANG_INVALID). Page bodies keep their ::lang{code="โ€ฆ"} โ€ฆ ::endlang{} blocks: see Multilingual courses.
  • Resource: key, type (game, repertoire or puzzles), label, sourceId, plus parameters that depend on the type.
  • key is a readable identifier, unique in the file (a-z, 0-9, -, 64 characters maximum). If it is missing it is derived from the title. Links between pages use the key: [[page:my-key]] (converted to the real id on import).
  • id, baseHash, courseId and sourceId are identity fields that must not be modified: they are used to update an existing course. A new page or module has no id. For a copied page, remove id and baseHash from the copy, otherwise the import refuses the file (duplicate identifier).
  • published is informational: imported or updated pages are always drafts.

Front matter: a strict YAML subset

key: value, multi-line text by indentation, # ... comments. A plain value that contains : or #, ends with :, or starts with one of { ' > & * ! | must be quoted, otherwise the import reports a clear โ€œput it in quotesโ€ error with the line number. Booleans are true and false.

Reserved lines

Any line of the form <!-- lilychess:... --> is a separator. If a page body contains such a line, the export shifts it by one space (warning SEPARATOR_ESCAPED). Never write such a line in the text of a page.

Tips when an AI edits the file

  • Keep the first line, the separators and every id, baseHash, courseId and sourceId field.
  • Only change titles and page bodies; do not invent ids, especially resource ids.
  • Write moves in English SAN (Nf3, Bb5, O-O).
  • Respect the page format: restricted Markdown, tags on their own line.
  • When an import fails, the report gives the line number and the block: fix that precise point and import again.

See also formats, modes and the import flow and updating an existing course.