Skip to content

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.

Generate a searchable, multi-page Course Reference site ready for GitHub Pages, Cloudflare Pages, or S3:

Terminal window
openl2 site course courses/cefr --out dist/cefr

You can also publish a standalone reference site for any language library:

Terminal window
openl2 site library libraries/de --out dist/de

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:

Terminal window
# Export the first 5 tasks of a level as an .apkg deck with LLM enrichment and OpenAI TTS
openl2 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 LLM
openl2 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 customization
openl2 anki export-templates dist/anki-templates

Key options:

  • --l1 / --native-language: Learner L1 for glosses, sentence translations, cloze hints, and production cues (defaults to the course’s instruction_language).
  • --model / --no-llm: Enriches cards via OpenAI structured outputs (defaults to OPENL2_ANKI_MODEL, OPENL2_OPENAI_MODEL, or gpt-6-luna; requires OPENAI_API_KEY), or use --no-llm for 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, or edge), 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 hierarchical openl2::... tags.
  • --include-proper-nouns: Opts proper nouns (pos: proper_noun) back into standalone cards (skipped by default).

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):

Terminal window
# Render one task in Spanish (L1) as printable HTML using an LLM
openl2 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 book
openl2 book render-level courses/cefr/en/a2 --limit 5 --format html --out dist/a2-book.html

Key options:

  • --l1 / --instruction-language: Language for explanations, cloze hints, answer-key translations, and prompts (defaults to the course’s instruction_language).
  • --format: markdown (default) or html (self-contained with @media print page breaks).
  • --model: OpenAI model name (defaults to OPENL2_BOOK_MODEL, OPENL2_OPENAI_MODEL, or gpt-6-luna; requires OPENAI_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 private or public course directly to Jetway:

Terminal window
openl2 jetway publish courses/cefr/de --visibility private

Want to build an exporter for another app or integrate OpenL2 in Python? See Building plugins and Integrating OpenL2.