A little code.
Something to remember.

Explore the source, flip the cards, and open the generated decks in Anki. These web previews use the same fields as the downloads.

Read the complete source

Basic

A Spanish greeting with a question, an answer, and an explicit stable ID. Start here for simple front-and-back cards.

basic.rsRust excerpt
let (front, back) = ("hola", "hello");
let mut deck = Deck::new("Spanish");
deck.basic().note(front, back).stable_id("es:hola").add()?;
let report = deck.write_apkg(output.join("spanish.apkg"))?;
report.ensure_success()?;
Spanish
Spanish → English

hola

What does this mean?
Download spanish.apkg 1 note · 1 card · 0 media files

Cloze

Hide a word in context with Anki’s cloze syntax. This note has one deletion, so it generates one card.

cloze.rsRust excerpt
let text = "A sound's pitch depends on its {{c1::frequency}}.";
let extra = "More cycles per second, higher pitch.";
let mut project = Project::new("Sound")
    .stable_id("website-sound")
    .default_deck("Sound");
project.add_note(Note::cloze(text).extra(extra).stable_id("sound:pitch"))?;
let report = project.write_apkg(output.join("sound.apkg"))?;
report.ensure_success()?;
Sound
Complete the sentence

A sound's pitch depends on its […].

Download sound.apkg 1 note · 1 card · 0 media files

Media

An image and a playable tone, packaged with the note. This excerpt uses an ear-training note type defined in the full source.

media.rsRust excerpt
let (prompt, answer) = ("Name this pitch.", "A4, 440 Hz");
let picture = project
    .media_mut()
    .add_file(output.join("waveform.svg"))?
    .export_as("waveform.svg")?;
let audio = project
    .media_mut()
    .add_file(output.join("concert-a.wav"))?
    .export_as("concert-a.wav")?;
project.add_note(
    Note::new("ear-training")
        .stable_id("sound:a4")
        .text("prompt", prompt)
        .text("answer", answer)
        .image("picture", picture)
        .sound("audio", audio),
)?;
let report = project.write_apkg(output.join("ear-training.apkg"))?;
report.ensure_success()?;
Ear Training
Ear training

Name this pitch.

Illustrative waveform of a synthesized tone
Download ear-training.apkg 1 note · 1 card · 2 media files

One note, two versions.

The second build changes the answer from “hello” to “hello; hi”. It compares against the first package and checks that the note identity is preserved.

let report = project.build(BuildOptions::new().output(&next).compare_to(&previous))?;
report.ensure_success()?;
Stable note IDes:hola
Front

hola

Back

hello

Try a content change.

Anki’s import settings and local edits affect how updates are applied. The previews show content and identity; card styling and review behavior come from Anki.