Table of Contents
Before we start at this, take some time to glance over the official
Anki add-on writing guide. It's by no means comprehensive (one of the
main impetuses behind me writing this), but it does offer a great
explanation of the basics. Don't worry too much about it though. We'll
be going over things it covers.
1 Add-on Structure
Let's start by looking at the section labeled 'Add-on Folders'. This tells us a good deal about how add-ons are organized/use storage, but there's only two main points we need to know now for writing our first basic add-on:
- Each add-on lives in its own folder within the
addons21folder of your local Anki directory
- Each add-on must have an
__init__.pyfile in its root directory.
Everything after this is up to you.
So, assuming we want to make an add-on now, let's try creating an add-on folder. You can do so with the code below:
cd ~/.local/share/Anki2/addons21 #navigates to your addon folder mkdir my_addon && cd my_addon #creates our folder and enters
Next let's create our required
Congratulations. We've just built our first Anki add-on. If you were
to open/reload Anki now add look at your installed add-ons
ctl-shft-a), you'd see your add-on listed there. The only issue:
this add-on does nothing. Let's go on to look at the official Anki
add-on guide's model add-on.
ln -s ~/.local/share/Anki2/addons21/my_addon anki-addon