Package: ankivalenz
AnkivalenzAnkivalenz is a tool for generating Anki cards from HTML files. Read myblog postfor more information on the "Why" of Ankivalenz.Use with QuartoAnkivalenz can be used withQuarto. Take a look at
the repo for thequarto-ankivalenzextension for more information.TutorialIn this walk-through we will write our notes as Markdown files, use
pandoc^pandocto convert them to HTML, and finally use Ankivalenz to
generate an Anki deck with Anki cards extracted from our Markdown files.InstallationAnkivalenz is distributed as a Python package, and requires Python 3.10+. To install:$ pip3 install ankivalenzInitialize projectCreate a folder for your notes:$ mkdir Notes
$ cd NotesAnkivalenz needs a configuration file, containing the name and ID of the
Anki deck. This can be generated withankivalenz init:$ ankivalenz init .Write a noteAdd the following to a file namedCell.md:# Cell## Types-Prokaryotic ?:: does not contain a nucleus-Eukaryotic ?:: contains a nucleusGenerate Anki deckConvert it to HTML:$ pandoc Cell.md > Cell.htmlAnd run Ankivalenz:$ ankivalenz run .This generates a fileNotes.apkgthat can be imported to Anki. Open
Anki and go to File -> Import, and findNotes.apkg.Updating Anki deckIf you make changes to your notes, you can update the Anki deck by
runningankivalenz runagain. It is not possible to mark cards
as deleted, so if you remove a note, the corresponding card will
remain in the Anki deck. To work around this issue, all cards are
tagged with a timestamp, and you can use the Anki browser to delete
cards with an old timestamp. Runningankivalenz runwill provide
you with the filter needed to delete orphaned cards:$ ankivalenz run .
- Added 3 notes to deck Biology in Biology.apkg
- Import the .apkg file into Anki (File -> Import)
- Find and delete orphaned notes with this filter (Browse):
    deck:Biology -tag:ankivalenz:updated:1666899823ReviewThe new Anki deck will have two cards:QuestionAnswerPathProkaryoticdoes not contain a nucleusCell > TypesEukaryoticcontains a nucleusCell > TypesThis is what the first note looks like in Anki:SyntaxFront/back cardsAnkivalenz supports front/back cards, where the front is the question
and the back is the answer. To create a front/back card, add a new list item
with the question, followed by?::and the answer:-Color of the sun ?:: YellowYou can flip the order of the question and answer by using::?instead:-Anwer ::? QuestionTwo-way cardsTwo-way cards can be created with:::-Side 1 :: Side 2This will create two cards in Anki:FrontBackSide 1Side 2Side 2Side 1Standalone questions/answersSometimes you want to create a note refering to the parent heading.
This can be done with standalone questions/answers:-Sun-::? The star in our solar systemThis will create a note with the answer "Sun" and the question "The star
in our solar system". The other types of delimeters ("::" and "?::") can
be used in the same way.Cloze cardsAnkivalenz supports cloze deletion^cloze, where the answer is hidden in the
question. To create a cloze card, add a new list item with the question,
using Anki's cloze syntax:-The {{c1::sun}} is {{c2::yellow}}.Nested listsLists can be nested:-Solar System-Star ?:: Sun-Planet-Earth ?:: Blue-Mars ?:: RedThe headings for the nested lists become a part of the notes' paths:QuestionAnswerPathStarSunSolar SystemEarthBlueSolar System > PlanetMarsRedSolar System > PlanetMathIf you are writing Markdown files, and use pandoc to convert them,
the following syntax for math is supported:-Inline math: $1 + 2$-Display math: $$1 + 2$$With the--mathjaxflag, pandoc will generate the correct markup,
using\( ... \)as delimeters for inline math, and\[ ... \]as
delimeters for display math:$ pandoc --mathjax Note.md > Note.htmlConfigurationankivalenz.jsontakes the following options:OptionDescriptiondeck_nameThe name of the Anki deck.deck_idThe ID of the Anki deck.input_pathThe path to the folder containing the HTML files.