This project adds advanced features to your Anki cards. You can add these features by including a few files in the Anki user directory (instructions below). You can also add these files to your Anki web account to sync them across all the devices on which you use Anki (which can't be done with addons). Hence, the name Anki Global Features.
Table of Contents |
---|
About Anki |
Advanced Typed Inputs |
Global Card Styles |
Installation |
Usage |
FAQ |
Updates |
Issues |
If you're unfamiliar with Anki, in a nutshell, it's an open-source digital flashcard system that uses spaced repetition to help you retain knowledge in your long-term memory.
Anki apps are available for the following:
Device | OS | Type |
---|---|---|
AnkiPC | Windows, Mac, or Linux | Free |
AnkiWeb | Web | Free |
AnkiMobile | iOS & iPadOS | Paid |
AnkiDroid | Android | Free |
Anki has a default input field you can use on the AnkiPC app to type an answer to a card's question. However, it has many limitations and is not available across all apps. Adding the Advanced Typed Inputs setup improves on the default and allows you to use typed answers on all devices. I initially developed this setup specifically for programming reviews, but it can be used for any topic you study.
Multiline Typed Inputs - Anki's default input field only allows a single input line. Advanced Typed Inputs allow you the freedom of adding multiple lines (perfect for code blocks).
Infinity Typed Inputs - Anki's default input field can only be used once per card. Advanced Typed Inputs allow you the freedom to add additional input fields (perfect for when you have a 2-part question).
Note: While the Infinity Typed Inputs feature gives you the ability to add as many inputs as you want on a single card, you'll get the most benefit from your reviews by keeping your cards simple. For me, that means having only one extra optional input per card which can be used for a quick follow-up question or typed code example.
Streamlined Comparison Answers - Anki currently uses different comparison algorithms for its different Anki apps. This gives you different results depending on which device you're using. Advanced Typed Inputs streamlines this by using a single comparison algorithm, synced across all Anki apps to produce the same comparison results no matter which device you are using.
Unlimited Comparison Answers - Like the input fields themselves, Anki limits the comparison answers to just one per card, even if you have multiple inputs for which you would like comparison answers. Advanced Typed Inputs allow you to have unlimited comparison answers per card so you can compare all your multiline typed inputs.
Anki cards are plain vanilla without any customization. Global Card Styles allows you to set custom default styles for all your cards and then have CSS variable overrides to change specific styles (such as the color) for different card topics.
The initial setup for Anki Global Features requires the use of the free AnkiPC app. This means you'll need to use a device running Windows, macOS, or Linux. Once set up, you can use the features on any Anki app.
If you don't already have AnkiPC installed, install it now by visiting Anki and clicking the download button (available for macOS, Windows, and Linux).
You have three options for downloading the files:
- You can download the files you want individually (see below).
- You can download the entire repository as a zip file: Download Zip
- You can clone the repository to your local computer with:
git clone [email protected]:jacobcassidy/anki-global-features.git
You can download individual files by going to the file's GitHub page and clicking the small download button...
The only files required are in the collection.media directory:
File | Purpose |
---|---|
_global.js | Creates the Advanced Typed Inputs feature and shows/hides card details based on individual card data. |
_global.css | Sets the card styles shared between all cards. Can be overridden with specific card styles. |
_diff_match_patch.js | Provides the global answer comparison algorithm |
_styles_for_syntax_highlighting.css | Optional: Styles for the Syntax Highlighting (NG) addon |
_mesloLGL-NF.woff2 | Optional: Mono font file for code display. |
After you download the above files, you will need to move them to your local Anki collection.media
directory [ref]:
OS | Location |
---|---|
macOS | ~/Library/Application Support/Anki2/[username]/collection.media/ |
Windows | APPDATA\Anki2\[username]\collection.media\ |
Linux | ~/.local/share/Anki2/[username]/collection.media/ |
Note:
[username]
is your Anki profile name. The default profile name isUser 1
.
For the Advanced Typed Inputs to work, you must add two things inside the Anki app:
-
You must add the card fields you want to use. For example, I use the following fields:
Question Answer Type Hint Compare Bonus Question Bonus Type Hint Bonus Compare Notes
-
You need to add HTML (templates provided) to your Note Types created under the
Anki > Tools > Manage Note Types
menu. The field names must match what you created above and you must include the script to calls the_global.js
file.
You can use the default template files found below if you are using the fields above. Otherwise, you will need to make modifications to those templates.
HTML Template Files | Purpose |
---|---|
/assets/note-types/*.html | Use in the Anki app under the Anki > Tools > Mangage Note Types menu. |
For the Global Card Styles to work, you must add two things inside the Anki app:
- In the card's styling section, you need to the stylesheet imports for the global files.
- In the same section, you need to add any overrides you want for that specific card type (aka note type).
You can use the default CSS templates I use and customize them however you see fit...
TO BE UPDATED
Anki plugins only work with the AnkiPC app and are incompatible across other devices such as mobile. If that changes, please let me know by opening an issue.
Anki has a Check Media feature, which can delete unused media files not contained in any cards. Adding the leading underscore, such as _global.js
, makes Anki ignore that file so it won't be deleted when using the Check Media feature.
View the Changelog to see the latest updates. Currently, you will need to manually copy/paste any changes you want to your local Anki files, then start, or restart the AnkiPC app if you have it open, so the updates can be synced.
If you come across any issues, please report them here.