MemoScript Syntax
A YAML-based language for writing flashcards quickly and expressively.
MemoScript is a simple YAML syntax for creating flashcards. Each file is a YAML array of card objects. MemoScript supports four card types:
- Basic — a front/back question-answer pair
- Reversible — a basic card that also generates a flipped version
- Cloze — fill-in-the-blank with
{{markers}} - Multiple Choice (MCQ) — a question with selectable choices
Quick example
What is the capital of France?
Paris
Bonjour
Hello
The mitochondria is the powerhouse of the cell
mitochondria
Which planet is largest?
General rules
- A MemoScript file must be a YAML array (each item starts with
-). - Card type is detected automatically from the fields present.
- Detection priority:
clozefield →choicesfield →front/back(with optionalreversible). - All string values are trimmed of leading/trailing whitespace.
- Unknown fields are ignored — only recognised fields affect card type.
Basic Cards
A Basic card is the simplest card type — a question on the front and an answer on the back.
Syntax
- front: Your question or prompt
back: Your answer or responseShorthand aliases
You can use Q/A (or lowercase q/a) instead of front/back:
- Q: What is the capital of France?
A: Paris
- q: Define photosynthesis
a: The process by which plants convert light into chemical energyFields
| Field | Type | Required | Aliases |
|---|---|---|---|
front | string | Yes | Q, q |
back | string | Yes | A, a |
What it creates
A Basic card renders as a two-sided flashcard. During study, you see the front side first and reveal the back side to check your answer.
Validation rules
- Both
frontandbackmust be present and non-empty after trimming. - If
frontis missing or empty → error: "Front side cannot be empty" - If
backis missing or empty → error: "Back side cannot be empty" - If
reversible: trueis also set, the card becomes a Reversible card instead.
Try it
What is the capital of France?
Paris
Examples
# Full syntax
- front: What year did World War II end?
back: "1945"
# Shorthand
- Q: What is 2 + 2?
A: "4"
# Multi-line values
- front: >
Explain the difference between
a stack and a queue.
back: >
A stack is LIFO (last in, first out).
A queue is FIFO (first in, first out).Reversible Cards
A Reversible card is like a Basic card, but it also creates a second card with front and back swapped. This is useful for vocabulary, translations, or any pair you want to study in both directions.
Syntax
- front: Term A
back: Term B
reversible: trueThe Q/A shorthand works here too:
- Q: photosynthesis
A: 6CO₂ + 6H₂O → C₆H₁₂O₆ + 6O₂
reversible: trueFields
| Field | Type | Required | Aliases |
|---|---|---|---|
front | string | Yes | Q, q |
back | string | Yes | A, a |
reversible | boolean | Yes | — |
What it creates
One YAML entry produces two study cards:
- Forward — front → back (same as a Basic card)
- Flipped — back → front
This means writing one reversible card gives you twice the study material.
Validation rules
- Same rules as Basic cards — both
frontandbackmust be non-empty. - The
reversiblefield must be explicitly set totrue. - If
reversibleis absent orfalse, the card is treated as a Basic card.
Try it
Bonjour
Hello
Examples
# Language vocabulary
- front: Bonjour
back: Hello
reversible: true
# Capitals
- front: Berlin
back: Germany
reversible: true
# Chemical symbols
- Q: Fe
A: Iron
reversible: trueCloze Cards
A Cloze card hides one or more words inside {{double braces}}. During study you see the sentence with blanks and must recall the hidden text.
Syntax
- cloze: The {{mitochondria}} is the powerhouse of the cellMultiple blanks
You can have as many blanks as you like in a single card:
- cloze: "{{Paris}} is the capital of {{France}}"With options (multiple-choice cloze)
You can optionally provide answer choices for each blank. The first item in each array must match the blank exactly:
- cloze: The {{sun}} is a {{star}}
options:
- [sun, moon, planet]
- [star, planet, asteroid]Fields
| Field | Type | Required | Description |
|---|---|---|---|
cloze | string | Yes | Text with {{markers}} for blanks |
options | string[][] | No | Answer choices per blank |
What it creates
A Cloze card renders the full sentence with the {{marked}} portions replaced by blanks. You must fill in each blank to complete the card.
When options are provided, each blank is presented as a multiple-choice selector instead of a free-text input.
Validation rules
- The
clozetext must be non-empty after trimming. - Must contain at least one
{{marker}}— error: "Cloze card must have at least one {{hidden}} marker" - If
optionsare provided:- Must be an array of arrays (
string[][]). - The number of option arrays must exactly match the number of blanks — error if mismatched.
- Each option array must have at least 2 items (the correct answer plus at least one distractor).
- The first item in each array must match the corresponding blank text exactly.
- Must be an array of arrays (
Try it
The mitochondria is the powerhouse of the cell
mitochondria
Examples
# Single blank
- cloze: The {{mitochondria}} is the powerhouse of the cell
# Multiple blanks
- cloze: "{{Newton}} published the Principia in {{1687}}"
# With options for each blank
- cloze: The {{mitochondria}} is the {{powerhouse}} of the cell
options:
- [mitochondria, chloroplast, ribosome]
- [powerhouse, factory, engine]
# Longer text
- cloze: >
In {{1969}}, {{Neil Armstrong}} became the first
person to walk on the {{Moon}}.Multiple Choice Cards
An MCQ card presents a question with a list of choices. Correct answers are marked with [square brackets].
Syntax
- front: Which planet is largest?
choices:
- Earth
- Mars
- [Jupiter]
- SaturnMultiple correct answers
Wrap every correct choice in brackets:
- front: Select all prime numbers
choices:
- [2]
- 4
- [5]
- 6
- [7]Fields
| Field | Type | Required | Aliases |
|---|---|---|---|
front | string | Yes | Q, q |
choices | string[] | Yes | — |
How correct answers work
- A choice written as
[Jupiter]is marked correct. The brackets are stripped from the displayed text — the student sees "Jupiter", not "[Jupiter]". - Any choice not wrapped in brackets is an incorrect distractor.
- You can mark one or many choices as correct.
What it creates
An MCQ card shows the question on top and the choices as selectable options. The student picks one (or more) and the card reveals which answers are correct.
Validation rules
front(orQ/q) must be non-empty — error: "Front side cannot be empty"choicesmust be an array with at least 2 items — error: "MCQ card must have at least 2 choices"- At least one choice must be wrapped in
[brackets]— error: "MCQ card must have at least one correct answer marked with [brackets]"
Try it
Which planet is largest?
Examples
# Single correct answer
- front: What is the chemical symbol for water?
choices:
- CO2
- [H2O]
- NaCl
- O2
# Multiple correct answers
- front: Which of these are programming languages?
choices:
- HTML
- [Python]
- [JavaScript]
- CSS
# With Q shorthand
- Q: Who painted the Mona Lisa?
choices:
- Michelangelo
- [Leonardo da Vinci]
- Raphael
- Donatello