Skip to content
/ flash Public

An Anki add-on that can autofill fields when creating notes.

License

Notifications You must be signed in to change notification settings

veyndan/flash

Repository files navigation

Flash

⚠️ Flash is in alpha. Backwards incompatible changes are likely and Flash can break without notice.

Flash is an Anki add-on that can autofill fields when creating notes.

demo.mp4

Install

Setup

Clone the repo and install the required dependencies.

git clone https://github.com/veyndan/flash.git
cd flash
python3 -m venv .venv
source .venv/bin/activate 
python -m pip install -r requirements.txt

Symlink Flash to Addons folder

cd flash
ln -sf "$(pwd)" ~/Library/Application\ Support/Anki2/addons21/flash  

Run Anki with Flash Installed

cd flash
yarn --cwd "./ts" && yarn --cwd "./ts" build && DISABLE_QT5_COMPAT=1 ./../.venv/bin/anki

To check that the add-on is correctly installed, go to Tools > Add-ons, and you should see Flash listed among them.

To upgrade, just run git pull while in the Flash directory, and restart your Anki program.

Usage

To begin using Flash, you first need to associate a query URL with a note type.

To add a new note type:

  • Go to Tools > Manage Note Types
  • Click Add
  • Click Add: From URL
  • Insert a name for the new note type. This can be anything you want.
  • Copy-paste the Query URL below for whichever query you want
  • Click OK

Once you've added the new note type, you can just add a new note as normal, and make sure that the new note type is selected in the note editor view. You will see that some fields are suffixed with [REQUIRED]. These fields are required to be filled out. Once you've filled out these fields, hit the Generate button in the toolbar. After a short while, the note should be automatically populated!

Available Queries

The following are queries that you can use to start generating Anki notes.

Description Input Output Query URL
Translate from English nouns to German nouns
  • English noun
  • German noun
  • English plural
  • English example sentence
  • German plural
  • German grammatical genders
  • German pronunciation audio files
https://raw.githubusercontent.com/veyndan/flash/flash/master/de_en.rq
Uppercase text (practically useless, but good for demos) Arbitrary text Your text in uppercase https://raw.githubusercontent.com/veyndan/flash/flash/master/uppercase.rq

Custom Query Development

If you need notes that can't be generated via the above queries (which is likely), then you'll need to develop your own query.

Queries are written in SPARQL and must be available via a URL. To get started, have a look at how the queries in Available Queries are developed. At the moment, there is a large usage of Wikidata, but any service that provides a SPARQL interface can be used. The query should be valid against this SHACL graph. Note that all queries are validated against the SHACL graph when adding a new note type via Add: From URL (per the Usage section).

While developing the query, it's useful to host it via localhost. If you then wish to share the query with the rest of the world, you'll need to host it somewhere (e.g., your own domain, GitHub). Also, please create a PR to add your query to the Available Queries table above!

If you face any issues surrounding query creation, please file an issue. Changing the API now is a lot easier than when we hit a 1.0 release.

About

An Anki add-on that can autofill fields when creating notes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published