/obsidian-awesome-flashcard

Handy Anki integration for Obsidian.

Primary LanguageTypeScriptMIT LicenseMIT

Awesome Flashcard

Plugin to sync flashcards in your Obsidian notes to Anki.

Design philosophy

  • Single source of truth. Synchronizes flashcards only in one direction: from your Obsidian notes to Anki.
  • Simplicity matters. Only one simple way to define flashcard.
  • Stick to openness. Standard Markdown as flashcard format, Introduces zero private syntax.
  • Minimal footprint. Stores no private data on your notes. Does not affect your Anki learning progress.

Features

  • ♳ Synchronizes all flashcards in your vault to Anki, in one direction
  • ✍ Preserves Anki learning progress
  • ✒ Full Markdown syntax support: 🖼️image, 🎤audio, 🎞️video, 📟code block, 🔢LaTeX, 📋table...
  • 🎴 Supports defining deck names both vault-wide and file-wide
  • #️⃣ Supports defining tags both flashcard-wide and file-wide
  • ⚡ Decent speed for incremental scanning
  • 🔗 Quick link to corresponding Obsidian note

Flashcard example

In your Obsidian note:

---
A simple flashcard: Question in the front #flashcard
Answer in the back
---

will generate an Anki flashcard like this:

A simple flashcard: Question in the front
Answer in the back

see more examples in sample.md

One time setup

These steps only need to be done once.
After that ensuring Anki running would suffice to scan vault with the plugin.

  1. Start up Anki, and navigate to your desired profile.
  2. Ensure that you've installed AnkiConnect.
  3. Have Obsidian installed
  4. Search the 'Community plugins' list for this plugin
  5. Install the plugin.
  6. In Anki, navigate to Tools->Addons->AnkiConnect->Config, and change it to look like this, then restart Anki to apply the changes:
{
    "apiKey": null,
    "apiLogPath": null,
    "webBindAddress": "127.0.0.1",
    "webBindPort": 8765,
    "webCorsOrigin": "http://localhost",
    "webCorsOriginList": [
        "http://localhost",
        "app://obsidian.md"
    ]
}

How to use

Make sure Anki is running, on left sidebar's Ribbon there is an Anki icon like this:

Click it and the plugin will do the rest for you. Process is shown on Notice and in the Obsidian Developer Console

Synchronization mechanism clarified

To fulfill these goals:

  • One-way synchronization from your Obsidian notes to Anki, and not vice versa. Auto adds new, removes deleted and updates obsolete flashcards
  • Does not affect your own flashcards (which are not from your Obsidian notes)
  • Stores no private data on your notes.

The synchronization is designed as follows:

  • Flashcard's deck name and front text are combined to get a unique hash
  • Each flashcard from Obsidian is tagged with the hash to tell from your own flashcards
  • When scanning vault, it will diff flashcards in Obsidian (computed dynamically) and Anki based on unique hash, create decks and CRUD flashcards accordingly