Export & publish a course
Once your course passes openl2 validate, you can publish it as a static web reference, export flashcards for Anki, or publish it directly to Jetway—using the same YAML source.
Publish a static reference site
Section titled “Publish a static reference site”Generate a searchable, multi-page Course Reference site ready for GitHub Pages, Cloudflare Pages, or S3:
openl2 site course courses/cefr --out dist/cefrYou can also publish a standalone reference site for any language library:
openl2 site library libraries/de --out dist/deExport a course to Anki
Section titled “Export a course to Anki”The built-in anki plugin compiles a single task or an entire level into a self-contained .apkg deck (with styled light/dark HTML+CSS note templates, deterministic GUIDs for safe re-imports, syllabus-ordered cards, and optional TTS audio), an interactive HTML card preview, or a live AnkiConnect sync:
# Export the first 5 tasks of a level as an .apkg deck with LLM enrichment and OpenAI TTSopenl2 anki export-level courses/cefr/es-mx/a1 --limit 5 --tts openai --out dist/es-mx-a1.apkg
# Preview cards in a browser (light/dark toggle, filters, inline audio) without calling an LLMopenl2 anki export-level courses/cefr/es-mx/a1 --limit 5 --no-llm --tts macos \ --format preview-html --out dist/es-mx-a1-preview.html
# Export a single task (supports apkg, preview-html, notes-tsv, preview-tsv, json, template)openl2 anki export-task courses/cefr/es-mx/a1 ask-for-a-drink-to-go \ --format apkg --tts openai --out dist/order-drink.apkg
# Sync directly into a running Anki Desktop instance via AnkiConnect (idempotent upsert)openl2 anki sync courses/cefr/es-mx/a1 --limit 5 --tts openai --dry-run
# Export the OpenL2 Card HTML/CSS templates as local files for customizationopenl2 anki export-templates dist/anki-templatesKey options:
--l1/--native-language: Learner L1 for glosses, sentence translations, cloze hints, and production cues (defaults to the course’sinstruction_language).--model/--no-llm: Enriches cards via OpenAI structured outputs (defaults toOPENL2_ANKI_MODEL,OPENL2_OPENAI_MODEL, orgpt-6-luna; requiresOPENAI_API_KEY), or use--no-llmfor deterministic offline export.--cache-dir/--no-cache: Caches LLM enrichment by content hash in.openl2-anki-cache/.--tts/--tts-voice/--tts-cache-dir: Optional audio synthesis (none,openai,macos, oredge), cached by(provider, language, voice, text)in.openl2-anki-tts-cache/.--cards: Comma-separated card types to include (recognition,cloze,production,listening; defaults to all). Recognition is reading-only on the front; Listening deduplicates audio to at most one card per unique sentence.--subdecks: Splits tasks into per-task subdecks instead of the default single level deck with hierarchicalopenl2::...tags.--include-proper-nouns: Opts proper nouns (pos: proper_noun) back into standalone cards (skipped by default).
Render a self-study textbook & workbook
Section titled “Render a self-study textbook & workbook”The built-in book plugin renders a single task or an entire level into a self-study Markdown or printable HTML guide (key language notes, useful frames, all authored exercises as cloze-with-L1-hints, model dialogue, role-play prompt, and answer key):
# Render one task in Spanish (L1) as printable HTML using an LLMopenl2 book render-task courses/cefr/en/a2 cefr.a2.en.ask-a-pharmacist-for-help \ --l1 es --format html --out dist/pharmacist-es.html
# Render deterministically without an LLM (fast, offline, useful for testing)openl2 book render-task courses/cefr/en/a2 cefr.a2.en.ask-a-pharmacist-for-help \ --no-llm --out dist/pharmacist.md
# Render the first 5 tasks of a level into a multi-unit course bookopenl2 book render-level courses/cefr/en/a2 --limit 5 --format html --out dist/a2-book.htmlKey options:
--l1/--instruction-language: Language for explanations, cloze hints, answer-key translations, and prompts (defaults to the course’sinstruction_language).--format:markdown(default) orhtml(self-contained with@media printpage breaks).--model: OpenAI model name (defaults toOPENL2_BOOK_MODEL,OPENL2_OPENAI_MODEL, orgpt-6-luna; requiresOPENAI_API_KEY).--no-llm: Deterministic template mode with zero API calls.--cache-dir/--no-cache: Caches generated unit JSON by content hash in.openl2-book-cache/so unchanged tasks are not re-generated.
Publish a course to Jetway
Section titled “Publish a course to Jetway”Publish a private or public course directly to Jetway:
openl2 jetway publish courses/cefr/de --visibility privateWant to build an exporter for another app or integrate OpenL2 in Python? See Building plugins and Integrating OpenL2.