A VitePress plugin that adds interactive quizzes to your Markdown pages using a simple :::quiz fenced block syntax.
Features:
- π Single-choice, multiple-choice, and fill-in-the-blank questions
- πΎ Session persistence β answers survive page navigation
- π i18n: English, French, German, Italian, Spanish (or bring your own)
- βΏ ARIA roles, keyboard navigation, screen-reader announcements
- π¨ VitePress CSS variables β dark mode and custom themes work out of the box
- π Zero runtime dependencies beyond Vue
# bun
bun add vitepress-plugin-quiz
# npm
npm install vitepress-plugin-quiz// .vitepress/config.ts
import { defineConfig } from "vitepress"
import { quizMarkdownPlugin } from "vitepress-plugin-quiz"
export default defineConfig({
markdown: {
config(md) {
md.use(quizMarkdownPlugin)
},
},
})// .vitepress/theme/index.ts
import DefaultTheme from "vitepress/theme"
import { enhanceAppWithQuiz } from "vitepress-plugin-quiz"
import type { Theme } from "vitepress"
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
enhanceAppWithQuiz(app) // English by default; pass "fr", "de", "it", or "es"
},
} satisfies Theme:::quiz
question: What does CSS stand for?
answer: Computer Style Sheets
answer-correct: Cascading Style Sheets
answer: Creative Style Sheets
explanation: CSS = **Cascading Style Sheets** β the language that styles web pages.
shuffle: true
:::
:::quiz
question: What CSS property controls text color?
answer-input: color
explanation: The `color` property sets the foreground text colour.
:::Full guide, syntax reference, i18n docs, and live examples at:
https://matinfo.github.io/vitepress-plugin-quiz/
markdown-it plugin. Use in .vitepress/config.ts under markdown.config.
Registers <QuizQuestion> and <QuizPage> on the Vue app, provides the locale, and auto-injects styles. lang defaults to "en".
Access locale strings directly. getLocale falls back to English for unknown codes.
All TypeScript interfaces are re-exported from the main entry:
import type { QuizData, QuizAnswer, QuizLocale, QuizState } from "vitepress-plugin-quiz"See CONTRIBUTING.md.