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
- First line, exactly:
<!-- lilychess:course v1 --> - The course header, between two
---lines (front matter):title(required),description,baseLang,title_<code>,description_<code>,visibility,acceptMode,exportMode,exportedVersion,exportedAt,generator,courseId. - Free text (the help) that is ignored when reading.
- 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(trueorfalse, 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: ensets the course base language;title_fr: Ouvertures(or a multi-linedescription_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,repertoireorpuzzles),label,sourceId, plus parameters that depend on the type. keyis 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,courseIdandsourceIdare identity fields that must not be modified: they are used to update an existing course. A new page or module has noid. For a copied page, removeidandbaseHashfrom the copy, otherwise the import refuses the file (duplicate identifier).publishedis 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,courseIdandsourceIdfield. - 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.