Awesome Flashcard

approved

by awesomedog

Handy Anki integration.

36 stars5,823 downloadsUpdated 17d agoMIT

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. Progress is shown in Obsidian notices.

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

Development

Install the dependencies and build the plugin bundle:

npm install
npm run build

Run npm run check before submitting changes to execute linting, tests, and type checking together.

To deploy the built plugin directly into an Obsidian vault, pass the vault path to the deploy command:

npm run deploy -- "/path/to/vault"

The command copies main.js, manifest.json, and styles.css to .obsidian/plugins/obsidian-awesome-flashcard. You can also set the OBSIDIAN_VAULT environment variable and omit the path. After deployment, enable Awesome Flashcard under Obsidian's community plugins. Restart Obsidian after changing manifest.json; for source-only changes, rebuild and reload the plugin.

Release

Use npm's version command to update package.json, package-lock.json, manifest.json, and versions.json, then push the generated commit and tag (tags intentionally have no v prefix):

npm version patch
git push origin main --follow-tags

Pushing the tag starts the release workflow. It checks the version, builds the plugin, and creates a draft GitHub release containing main.js, manifest.json, and styles.css for review and publication.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.