Awesome
Obsidian_to_Anki
Plugin to add flashcards from a text or markdown file to Anki. Run in Obsidian as a plugin, or from the command-line as a python script. Built with Obsidian markdown syntax in mind. Supports user-defined custom syntax for flashcards.
See the Trello for planned features.
Getting started
Check out the Wiki! It has a ton of information, including setup instructions for new users. I will include a copy of the instructions here:
Setup
All users
- Start up Anki, and navigate to your desired profile.
- Ensure that you've installed AnkiConnect.
Obsidian plugin users
- Have Obsidian downloaded
- Search the 'Community plugins' list for this plugin
- Install the plugin.
- In Anki, navigate to Tools->Addons->AnkiConnect->Config, and change it to look like this:
- Restart Anki to apply the above changes
- With Anki running in the background, load the plugin. This will generate the plugin settings.
You shouldn't need Anki running to load Obsidian in the future, though of course you will need it for using the plugin!
To run the plugin, look for an Anki icon on your ribbon (the place where buttons such as 'open Graph view' and 'open Quick Switcher' are). For more information on use, please check out the Wiki!
Python script users
- Install the latest version of Python.
- If you are a new user, download
obstoanki_setup.py
from the releases page, and place it in the folder you want the script installed (for example your notes folder). - Run
obstoanki_setup.py
, for example by double-clicking it in a file explorer. This will download the latest version of the script and required dependencies automatically. Existing users should be able to run their existingobstoanki_setup.py
to get the latest version of the script. - Check the Permissions tab below to ensure the script is able to run.
- Run
obsidian_to_anki.py
, for example by double-clicking it in a file explorer. This will generate a config file,obsidian_to_anki_config.ini
.
Permissions
The script needs to be able to:
- Make a config file in the directory the script is installed.
- Read the file in the directory the script is used.
- Make a backup file in the directory the script is used.
- Rename files in the directory the script is used.
- Remove a backup file in the directory the script is used.
- Change the current working directory temporarily (so that local image paths are resolved correctly).
Features
Current features (check out the wiki for more details):
- Custom note types - You're not limited to the 6 built-in note types of Anki.
- Custom scan directory
- The plugin will scan the entire vault by default
- You can also set which directory (includes all sub-directories as well) to scan via plugin settings
- Ignore Folders and Files
- You can specify which files and folders to ignore
- This can be done in the settings of this plugin with Glob syntax.
- If you're working on your own globs, you can test them out here
- Examples:
**/*.excalidraw.md
- Ignore all files that end in.excalidraw.md
- => avoids excalidraw files from being scanned which can be extremely slow
Template/**
- Ignore all files in theTemplate
folder (including subfolders)**/private/**
- Ignore all files in folders that are calledprivate
no matter where they are in the vault[Pp]rivate*/**
- Ignore all files and folders in the root of the vault that start withprivate
or withPrivate
- Updating notes from file - Your text files are the canonical source of the notes.
- Tags, including tags for an entire file.
- Adding to user-specified deck on a per-file basis.
- Markdown formatting.
- Math formatting.
- Embedded images. GIFs should work too.
- Audio.
- Auto-deleting notes from the file.
- Reading from all files in a directory automatically - recursively too!
- Inline Notes - Shorter syntax for typing out notes on a single line.
- Easy cloze formatting - A more compact syntax to do Cloze text
- Frozen Fields
- Obsidian integration - A link to the file that made the flashcard, full link and image embed support.
- Custom syntax - Using regular expressions, add custom syntax to generate notes that make sense for you. Some examples:
- RemNote single-line style.
This is how to use::Remnote single-line style
- Header paragraph style.
- Question answer style.
- Neuracache #flashcard style.
- Ruled style
- Markdown table style
- Cloze paragraph style
- RemNote single-line style.
Note that all custom syntax is off by default, and must be programmed into the script via the config file - see the Wiki for more details.
<a href='https://ko-fi.com/K3K52X4L6' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>