Anki Flashcards Sync

by olofhaglund
5
4
3
2
1
Score: 35/100

Description

This plugin has not been manually reviewed by Obsidian staff. Pushes flashcards from notes to Anki. The flashcards are bashed on code blocks annotated with flashcard.

Reviews

No reviews yet.

Stats

stars
15
downloads
0
forks
1
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Obsidian Anki

NOTE: This is an early version and released early to catch hiccups in the distribution flow.

Obsidian plugin that renders flashcard code blocks as card previews and syncs them to Anki through AnkiConnect.

What it does

  • Renders flashcard code blocks in Reading view and Live Preview.
  • Loads note type/card template definitions from markdown files in Anki/.
  • Uses note frontmatter as card field values.
  • Renders one preview card per card template with a front/back toggle.
  • Replaces {{Audio}} in preview with a play button that plays the referenced vault audio file.
  • Syncs flashcards to Anki (create/update) using a deterministic source tag per block.
  • Auto-creates missing decks and missing note types in Anki.

Requirements

  • Obsidian desktop.
  • Anki desktop.
  • AnkiConnect enabled in Anki (default endpoint: http://127.0.0.1:8765).

Note type definitions (Anki/ folder)

Create one markdown file per note type under Anki/. Only frontmatter is used.

Example: Anki/French Sentence.md

---
name: French Sentence
cards:
  - name: With Sound Cue
    front_template: |
      {{french}}
      <br>
      {{Audio}}
    back_template: |
      {{FrontSide}}
      <hr>
      {{english}}
  - name: Without Sound Cue
    front_template: "{{french}}"
    back_template: |
      {{FrontSide}}
      <br>
      {{Audio}}
      <hr>
      {{english}}
style: |
  .card {
    font-family: Arial;
    font-size: 20px;
    text-align: center;
  }
---
# French Sentence
This text is not read and can be used a comment to the note .

Notes:

  • Quote single-line template values when using {{...}} on one line.
  • style and styling are both accepted.
  • If fields is omitted, fields are inferred from template placeholders.

Flashcard block format

Put flashcards in normal notes using fenced code blocks:

deck: French::Sentences
note_type: French Sentence
fields:
- french
- english
- Audio

Meaning:

  • deck: target Anki deck (:: supports subdecks).
  • note_type: note type name matching Anki/*.md name.
  • fields: frontmatter keys for this note. If omitted, inferred from the note type templates.

Field values from frontmatter

Values are read from the note's frontmatter.

Example note:

---
french: Ça va
english: How are you?
Audio: [[ca-va.wav]]
---

Audio supports:

  • [[file.wav]]
  • ![[file.wav]]
  • [label](file.wav)
  • direct vault path (French/Sound Files/file.wav)

Sync behavior

Command: Sync flashcards to Anki

Per flashcard block:

  • Resolves note type from Anki/*.md.
  • Validates required fields exist in note frontmatter.
  • Ensures deck exists.
  • Ensures note type exists (creates if missing).
  • Finds existing note by deterministic source tag.
  • Creates or updates note fields and tags.

Settings

  • AnkiConnect URL
  • Default deck
  • Default note type
  • Default tags
  • Auto sync (currently config only)
  • Sync scope (active-file, vault, folder)
  • Sync folder (when scope is folder)

Troubleshooting

  • Missing frontmatter key: add the key to the source note frontmatter or adjust fields.
  • Audio button says Audio not found: verify the file exists in the vault and link/path is valid.
  • If sync fails, the popup shows the first error and console logs detailed failures.

Security and privacy

  • Preview HTML is sanitized before rendering.
  • Network calls are only made to the configured AnkiConnect URL.
  • Data sent to Anki is limited to resolved card fields, deck/model names, and tags for sync.

Development

npm install
npm run dev
npm run build