Skip to content

QuizMD — Format Specification v0.2

Core principle: YAML everywhere

QuizMD uses YAML as its single configuration syntax, applied across three progressive and backward-compatible levels. Keys are the same at every level — one mental model to learn.

LevelMechanismPurpose
0Plain .quiz.md, no configurationMinimal quiz, human-readable
1YAML frontmatter at top of fileGlobal metadata, behavior, scoring
2Per-question ```quiz fenced blockPer-question overrides (points, timer, hint)

A Level 0 file is valid at Level 1 and 2. Each level is a strict superset of the previous one.


Level 0 — Base Markdown syntax

Conventions

SyntaxMeaning
## Qn or ## Qn · TitleStart of a question
- [x]Correct answer choice
- [ ]Incorrect answer choice
___Open-answer field (short answer / fill-in-the-blank)
---Question separator (optional when ## is used)
> textFeedback / explanation (shown after the answer is submitted)
!import ./file.quiz.mdInclude questions from a sub-quiz file
$...$Inline LaTeX math formula
$$...$$Block (display) LaTeX math formula

Question body

The body of a question is all Markdown content between the ## Qn heading (and its optional ```quiz block) and the first answer choice (- [ ] / - [x]) or the ___ marker. The body may contain multiple paragraphs, lists, tables, math formulas, and images — any valid Markdown.

This mechanism supports passage-based questions (reading comprehension, physics problems, legal cases) without any additional syntax.

Minimal example

markdown
# My first quiz

## Q1 · What is the capital of France?

- [ ] London
- [x] Paris
- [ ] Berlin

> Paris has been the capital since the 10th century.

## Q2 · True or false: The Earth is flat.

- [ ] True
- [x] False

## Q3 · Fill in the blank: The sun is a ___.

**Answer:** star

Question types

MCQ — Single correct answer

One - [x] marks the correct choice. All other choices use - [ ].

markdown
## Q1 · Which composer wrote "The Four Seasons"?

- [ ] Johann Sebastian Bach
- [ ] George Frideric Handel
- [x] Antonio Vivaldi
- [ ] Arcangelo Corelli

> "The Four Seasons" (1725) is a set of four violin concertos by Vivaldi.

Multi-select — Multiple correct answers

Two or more - [x] marks indicate multiple correct choices. Renderers should display checkboxes rather than radio buttons.

markdown
## Q2 · Which are characteristics of Baroque music?

- [x] Basso continuo
- [x] Terraced dynamics
- [ ] Twelve-tone serialism
- [x] Elaborate ornamentation
- [x] Counterpoint and polyphony
- [ ] Minimalist texture

Open answer — Fill in the blank

The ___ marker signals a free-text input field. The expected answer follows on a **Answer:** line.

markdown
## Q3 · Fill in the blank: Bach's 30 keyboard variations are known as the ___ Variations.

**Answer:** Goldberg

Multiple blanks in a single question are supported by repeating ___:

markdown
## Q4 · Complete: ___ was born in ___, Germany.

**Answer:** Handel | Halle

True / False

A True/False question is an MCQ with exactly two choices labeled True and False.

Match pairs

A match question associates items from two columns. Declared with type: match in the per-question block:

markdown
## Q6 · Match each composer with their nationality.

```quiz
type: match
points: 4
```

| Composer | Nationality |
|----------|-------------|
| Bach | German |
| Vivaldi | Italian |
| Handel | German |
| Rameau | French |

Order

An order question asks the learner to sort items into the correct sequence. Declared with type: order. The correct order is the order in which items appear in the list:

markdown
## Q7 · Place these composers in chronological order of birth.

```quiz
type: order
points: 3
```

1. Claudio Monteverdi (1567)
2. Heinrich Schutz (1585)
3. Jean-Baptiste Lully (1632)
4. Henry Purcell (1659)
5. Antonio Vivaldi (1678)

Feedback syntax

QuizMD supports four levels of feedback, freely combinable within a single question:

SyntaxScopeWhen displayed
> text (indented under a choice)Per-choiceOnly when that choice is selected
> [!correct] textGlobalOnly when the answer is correct
> [!incorrect] textGlobalOnly when the answer is incorrect
> textGlobalAlways (general explanation)

Display priority rules

  1. Per-choice feedback is displayed inline, below the option, only if the learner selected it.
  2. [!correct] or [!incorrect] appears in the result banner according to the outcome.
  3. Global > feedback always appears in the result banner, after the targeted feedback.
  4. For open-answer questions, only global feedback applies.

The !import directive

The !import directive includes questions from another .quiz.md file directly into the current quiz.

markdown
!import ./path/to/sub-quiz.quiz.md
  • Questions from the sub-quiz are inserted at the position of the directive.
  • Questions are renumbered sequentially across the full assembled quiz.
  • The frontmatter of the sub-quiz is ignored.
  • Imports are recursive. Circular imports are silently skipped.
  • Missing files are ignored without error.

Reveal and feedback modes

reveal — question display

ValueBehavior
all (default)All questions are displayed at once
sequentialQuestions are revealed one at a time

feedback_mode — when corrections appear

ValueBehavior
immediate (default)Correction shown immediately after submission
deferredAnswers recorded without revealing corrections; results shown at the end

Typical combinations

revealfeedback_modeUse case
allimmediatePractice mode (default)
sequentialimmediateGuided progression
alldeferredPaper-style exam
sequentialdeferredExam mode

Level 1 — YAML frontmatter

Frontmatter field reference

FieldTypeRequiredDefaultDescription
titlestringYesQuiz title
descriptionstringNoShort description
authorstring or objectNoAuthor name, or {name, email, url}
langBCP-47NoLanguage code
tagsstring[]No[]Thematic tags
domainenumNorecreational, academic, corporate, certification
revealenumNoallall or sequential
feedback_modeenumNoimmediateimmediate or deferred
shuffle_questionsboolNofalseRandomize question order
shuffle_answersboolNotrueRandomize answer choice order
passing_scorefloatNoMinimum ratio to pass (0.0–1.0)
time_limitintNoTotal time limit in seconds
scoring.correctintNo1Points per correct answer
scoring.incorrectintNo0Points per incorrect answer
spec_versionstringNoQuizMD spec version (e.g. "0.2")

Level 2 — Per-question fenced block

A ```quiz block placed immediately after the question heading overrides global parameters for that specific question.

Per-question block field reference

FieldTypeDescription
idstringStable unique identifier for this question
pointsintPoints for this question (overrides scoring.correct)
timerintPer-question time limit in seconds
hintstringHint shown on demand before submission
difficultyenumeasy, medium, or hard
tagsstring[]Per-question thematic tags
typeenummcq, multi, open, tf, match, or order
bloomenumBloom's taxonomy level
depends_onstringID of a question this one is conditional on

The type field is inferred automatically when omitted:

  • One - [x]mcq
  • Two or more - [x]multi
  • ___ present → open
  • Exactly two choices True / Falsetf

Math support

LaTeX math is auto-detected and rendered via KaTeX. No frontmatter flag required.

FormSyntaxRendering
Inline$E = mc^2$Embedded in the line of text
Block$$\int_0^\infty e^{-x}\,dx = 1$$Centered on its own line

ABC music notation

Supports ABC notation for rendering sheet music inline in question bodies. Flags: play, cursor, colors.


Penrose diagrams

Supports Penrose declarative mathematical diagrams via @penrose/core.


Partial scoring

When partial_scoring: true (default), match and order questions award a proportional score.

  • match: score = correct_pairs / total_pairs
  • order: Uses Kendall's tau (concordant pairs / all pairs)

Syntax reference table

ElementSyntaxLevel
Quiz title# Title0
Question heading## Q1 or ## Q1 · Title0
Correct choice- [x] text0
Incorrect choice- [ ] text0
Open answer marker___0
Expected answer**Answer:** value0
Per-choice feedback > text (indented)0
Correct-only feedback> [!correct] text0
Incorrect-only feedback> [!incorrect] text0
General feedback> text0
Sub-quiz import!import ./file.quiz.md0
Inline math$formula$0
Block math$$formula$$0
Frontmatter--- YAML ---1
Per-question config```quiz YAML ```2
ABC (static)```abc0
ABC (interactive)```abc play cursor colors0

Validation

Lenient mode (default)

ConditionLevel
No correct answer in an MCQWarning
title absent from frontmatterWarning
lang absent from frontmatterWarning
Unclosed ```quiz blockError
!import pointing to a missing fileWarning
Frontmatter YAML parse errorError

Strict mode (--strict)

ConditionLevel
title absentError
lang absentError
No correct answer in any questionError
All lenient-mode errorsError

Released under the MIT License.