AnkiWeb
- Rating
- 0 (π 0 Β· π 0)
- Updated
- 2026-06-19
- Anki versions
- 25.02.7~
- Description language
- en
AnkiWeb addon 2050299569
Provides IDE-style code input during Anki review with character-level diff against the solution, syntax highlighting for 31 languages, keyboard shortcuts, and a custom note type.
Open on AnkiWeb GitHub Ask about alternatives
active
| Min Anki | Max Anki | Updated |
|---|---|---|
| 2.1.1 | 25.02.7+ | 2026-06-19 |
Loadingβ¦
Enables proper type:cloze cards with multiple cloze blanks as input fields, instant feedback, and next-character hints in Anki.
Review single- and multiple-choice Anki questions in a clean exam-style screen showing your answer, correct answer, color-coded feedback, optional explanations, and auto-clearing selections.
Improves feedback for type-in-answer cards with multiple correct answers by rearranging answers before diffing, supports lenient validation, and groups combining marks for Indic scripts.
Provides AI-powered semantic scoring of typed Anki answers with multilingual feedback, review suggestions, configurable prompts, and support for multiple LLM providers.
Transforms Anki cloze cards into interactive fill-in-the-blank exercises with multiple input fields, instant feedback, hints, dropdown answers, and duplicate-cloze autofill.
Provides enhanced multi-line input for programming and code review cards, with language-specific comment handling, customizable dimensions, scrolling, auto-focus, and indentation preservation.
An Anki addon for coding practice. Type your answers in an IDE-style input field and get an instant, character-level diff against the solution.

This add-on is only supported on Anki Desktop.
It relies on features that are not available on AnkiMobile and AnkiWeb.
The add-on creates a new note type (Code Your Answer) with the following fields:
| Field | Required | Description |
|---|---|---|
| Front | β Yes | The question/prompt |
| Language | β Yes | Language code (e.g., python, javascript, rust) |
| Back | β Yes | Your code answer |
| Back Extra | β Optional | Additional notes, explanations, or context |
The Diff section provides a comparison of your code against the predefined solution. It uses the following color-coding to highlight discrepancies:
| Color | Meaning | Description |
|---|---|---|
Green |
Match | Characters you typed that match the solution exactly. |
Grey |
Omissions | Code that is in the solution but is missing from your attempt. |
Red |
Extra | Characters you typed that are not in the solution (typos, new names, extra logic etc). |

Anki's built-in editor converts whitespace to HTML entities ( for spaces, <br> for line breaks). This causes issues with the diff comparison, as your code won't match the solution due to formatting differences rather than actual code differences.
Use Obsidian_to_Anki to create cards from Obsidian markdown files. The plugin automatically converts code blocks to a format that works seamlessly with the diff, and looks great overall (in case you need formatted and syntax highighted code blocks on the front side and Back Extra)
Tutorial: Obsidian_to_Anki - How to use (3:31)
This is the recommended workflow when using this addon.
Install Syntax Highlighter to create cards directly in Anki with proper code formatting (tested with default settings).
Manual HTML wrapping is unnecessarily cumbersome. If this approach is unavoidable, use an external editor (such as VS Code) to format the code:
<pre><code>def greet(name) -> str:
return f"Hello, {name}"</code></pre>
Copy the entire block (including tags) and paste into the Back field. Obsidian_to_Anki or Syntax Highlighter are strongly preferred alternatives.
The diff only compares the Back field code, so any supplementary information should go in Back Extra.
Designed for a hands-on-keyboard workflow:
Tab: Performs Indentation by inserting 4 spaces (for all languges). This ensures your code structure is clean and readable, a standard requirement for almost all programming languages (especially Python!).Ctrl + Enter (or Cmd + Enter): Submits your answer and reveals the back of the card.Ctrl + / (or Cmd + /): Toggles a line comment on the selected line(s) using the correct syntax for the active language (e.g. // in JS, # in Python).Shift + Alt + A (or Alt + A on Windows) / Ctrl + Shift + A: Toggles a block comment around the selection for languages that support it (e.g. /* */ in JS/CSS).Go to Tools β Add-ons β Code Your Answer β Config to customise the editor. Restart Anki after saving for changes to take effect.
| Option | Default | Description |
|---|---|---|
theme |
"" |
Editor colour theme. Empty string uses the default themes (GitHub Light / One Dark) that follow Anki's light/dark mode. Set to a theme name to pin it regardless of mode. See the full list at fsegurai.github.io/codemirror-themes. View themes in action at the Playground. |
indentUnit |
4 |
Number of spaces per indentation level. |
indentWithTab |
true |
Allow the Tab key to indent. |
autocompletion |
false |
Show inline code completion suggestions. Disabled by default β keeping it off is recommended when using the editor for learning. |
fontSize |
14 |
Font size of the editor content in pixels. |
Some basic editor behaviours, such as bracket matching and auto-closing brackets, are hardcoded and cannot be changed. More options will be added in future releases.
2050299569The add-on is now installed and ready to use.
Note: The ZIP extraction may create a nested folder structure (e.g.,
code-your-answer-main/code-your-answer-main/). If this occurs, navigate into the innermostcode-your-answer-mainfolder and use that as your add-on directory.
If you have Git installed, run the following in your terminal:
git clone https://github.com/solmarita/code-your-answer.git
Locate your Anki addons folder:
Tools > Add-ons.addons21 directory.Copy the project folder: Move the code-your-answer folder (or code-your-answer-main if that is the extracted folder name) into the addons21/ directory.
Verify the structure: After copying, your addons21 directory should contain:
addons21/
βββ code-your-answer/
βββ __init__.py
βββ web/
βββ src/
βββ ... (other files)
This add-on uses Vite to bundle assets, which automatically generates unique filenames (e.g., front-BMzCq9aJ.js). When the add-on is updated or reinstalled from different sources, these filenames change, causing old card templates to reference broken asset paths.
If your cards stop working after updating the add-on:
Save your template modifications (if any):
Create a .dev file in the add-on folder to force template regeneration:
2050299569 folder (Code Your Answer).dev (no extension):
.dev in the add-on foldertouch .dev in the add-on folder (if you're familiar with the terminal)Restart Anki to regenerate templates with current asset paths
Restore your modifications (if any):
.dev file from the add-on folder (otherwise your template modifications will be overwritten the next time you start Anki)Your cards will now work with the updated asset paths.
Notes:
| Language | Acceptable Aliases (Case-Insensitive) |
|---|---|
| JavaScript | js, jsx, node, javascript, ecmascript |
| TypeScript | ts, tsx, typescript |
| Python | py, py3, python3, python, pypy |
| Rust | rs, rustlang, rust |
| PHP | php, php8, php7 |
| Go | go, golang |
| Zig | zig, ziglang |
| C++ | cpp, c++, cc, hpp, h++ |
| C | c, h |
| Java | java, jar |
| C# | cs, csharp, c# |
| HTML | html, htm |
| CSS | css |
| XML | xml, svg |
| Sass | sass, scss |
| Less | less |
| Vue | vue |
| Angular | angular, ng |
| SQL | sql, mysql, postgres, psql |
| WebAssembly | wasm, wat |
| Shell | sh, bash, zsh, shell, batch, ps1 |
| YAML | yaml, yml |
| JSON | json |
| Markdown | md, markdown |
| Swift | swift |
| Kotlin | kt, kotlin |
| Dart | dart, flutter |
| Ruby | rb, ruby, rails |
| Scala | scala |
| R | r, rscript |
| MATLAB | matlab, m |
Manual test status, verified by loading the language in the editor and confirming the following work correctly: syntax highlighting, auto indentation, auto-closing brackets, and bracket matching.
| Language | Tested |
|---|---|
| JavaScript | β |
| TypeScript | β |
| Python | β |
| Rust | β |
| PHP | β |
| Go | β |
| Zig | β |
| C++ | β |
| C | β |
| Java | β (see known issues section below) |
| C# | β (see known issues section below) |
| HTML | β |
| CSS | β |
| XML | β |
| Sass | β |
| Less | β |
| Vue | β |
| Angular | β |
| SQL | β |
| WebAssembly | β |
| Shell | β (see known issues section below) |
| YAML | β |
| JSON | β |
| Markdown | β |
| Swift | β |
| Kotlin | β |
| Dart | β |
| Ruby | β |
| Scala | β |
| R | β |
| MATLAB | β (see known issues section below) |
In languages like Java and C#, writing code outside of a class can cause the cursor to land at column 0 after certain lines (e.g. after };). Manually pressing Tab to indent should still work.
Affected (no wrapper):
String greet(String name) {
int[] items = {1, 2, 3};
// pressing Enter here β cursor lands at col 0
Not affected (inside a class):
class Greeter {
String greet(String name) {
int[] items = {1, 2, 3};
// pressing Enter here β correct indentation
<script> and <style> tags do not auto-close in HTML modeTyping <script> or <style> will not automatically insert the closing tag. This is a consequence of how CodeMirror's HTML language support works: these tags embed nested languages (JavaScript and CSS respectively), and it seems to prevent their tags from auto closing.All other HTML tags auto-close as expected.
The following languages use CodeMirror 5 legacy modes packages. Syntax highlighting works, but auto-indentation may be limited or unavailable. Manually pressing Tab to indent should still work.
Don't see your language? Check if CodeMirror supports it:
If you find it there, open an issue with the language name and I'll add it. If it's not there, I'll do my best to find a third-party package.
DISCLAIMER: This addon is under active development and may change frequently!
Option 1: Clone directly to Anki's addon folder
cd <path_to_anki_addons_folder>
git clone https://github.com/solmarita/code-your-answer.git
cd code-your-answer
Option 2: Clone elsewhere and symlink
# Clone to your preferred location
git clone https://github.com/solmarita/code-your-answer.git
cd code-your-answer
# Create symlink in Anki's addon folder
# macOS/Linux:
ln -s "$(pwd)" <path_to_anki_addons_folder>/code-your-answer
# Windows (run as Administrator):
mklink /D "<path_to_anki_addons_folder>\code-your-answer" "%CD%"
Finding your Anki addons folder:
- Open Anki, go to Tools > Add-ons.
- Click View Files to open the addons21 directory.
Install dependencies:
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
npm install
# Enable dev mode
touch .dev # Windows: type nul > .dev
# Build
npm run build
# Make changes to __init__.py or src/ files
npm run build
# Restart Anki to see changes
Tip: Install AnkiRestart for quick reloads during development.
The .dev file enables template auto-updates on Anki restart during development.
Disable dev mode before release:
rm .dev # macOS/Linux
# Windows: del .dev