An integration of ZettelKasten and Anki.
The idea is to sync between Zettel written in a specially formatted reStructuredText file and Anki such that:
- The Zettel start with a short representative text with focal words or phrases that will correspond to cloze deletions followed by more explanation as necessary and links to other Zettel.
- Links between notes are preserved and represented in Anki
This code relies on these add-ons:
- AnkiConnect which enables external applications to communicate with Anki over an HTTP API.
- link cards/notes and preview them in extra window which enables linking notes by Note ID (nid)
I recently found out about Zettelkasten through a friend, who pointed me to zettelkasten.de, and Sönke Ahrens’ How to Take Smart Notes. This approach to note management seems extremely powerful, and I already sometimes do something similar with my notes, but not consistently or deliberately. Those times when I do my best writing, it’s in part because of having collected superior notes and contemplated them, growing them and understanding them in wider contexts over months or years. Zettelkasten immediately appealed to me as a way to formalise what works best for me into my usual practice. I immediately wanted to start implementing it, but it seemed a bit at odds with the Anki practice I had been honing.
I use Anki in a slightly idiosyncratic way. With few exceptions, I find cloze deletions the most effective type of card for me, even for vocabulary, because I can use them to build contextual understanding. I will often when reviewing, spontaneously write new notes reflecting new ideas spurred by the review. I also had been using them as a way to remember ideas from journal papers or books.
I like that the Anki algorithm will help bring my notes up to me a again, which is something that may never happen with notes in a file system. And I also like the active memory practice which is far superior to just rereading. But I much prefer to edit my notes in files in emacs than in some GUI.
In general, Anki notes are better if they are short — no more than a sentence or two — whereas Zettel are probably usually better as a paragraph. So in my hybrid, I’m proposing to have a short summary which will display as the cloze text, and then the rest of the note in the “extra” field.
Note type called zkanki-cloze has fields:
This is regular cloze deletion text.
This allows the Zettel to be as long as necessary without making a cloze deletion card that’s too verbose. It also contains any links.
I’ll use reStructuredText markup, structured to be easy to parse to the Anki fields.
I had started designing this with org-mode in mind, despite several difficulties in the GitHub rendering which I also wanted to display well. However, once I realised I could use role inheritance in reST to markup cloze deletions, I switched to that.
See this example file for the format.
This results in:
The supported rst is pretty fragile. I had to make decisions about how to render footnotes, literals, and just generally hackish handling of idiosyncratic rendering.
Roundtrip still does not preserve all whitespace as desired.