Ankivalenz
Ankivalenz is a tool for generating Anki notes from HTML files.
Tutorial
In this walk-through we will write our notes as Markdown files, use pandoc1 to convert them to HTML, and finally use Ankivalenz to generate an Anki deck with Anki notes extracted from our Markdown files.
Installation
Ankivalenz is distributed as a Python package, and requires Python 3.10+. To install:
$ pip3 install ankivalenz
Initialize project
Create a folder for your notes:
$ mkdir Notes
$ cd Notes
Ankivalenz needs a configuration file, containing the name and ID of the
Anki deck. This can be generated with ankivalenz init:
$ ankivalenz init
Write a note
Add the following to a file named Cell.md:
# Cell
## Types
- Prokaryotic ?:: does not contain a nucleus
- Eukaryotic ?:: contains a nucleus
Generate Anki deck
Convert it to HTML:
$ pandoc Cell.md > Cell.html
And run Ankivalenz:
$ ankivalenz run .
This generates a file Notes.apkg that can be imported to Anki. Open
Anki and go to File -> Import, and find Notes.apkg.
Review
The new Anki deck will have two notes:
| Question | Answer | Path |
|---|---|---|
| Prokaryotic | does not contain a nucleus | Cell > Types |
| Eukaryotic | contains a nucleus | Cell > Types |
This is what the first note looks like in Anki:
Syntax
Front/back cards
Ankivalenz 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 ?:: Yellow
You can flip the order of the question and answer by using ::? instead:
- Anwer ::? Question
Two-way notes
Two-way notes can be created with :::
- Side 1 :: Side 2
This will create two cards in Anki:
| Front | Back |
|---|---|
| Side 1 | Side 2 |
| Side 2 | Side 1 |
Cloze cards
Ankivalenz supports cloze deletion2, 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 lists
Lists can be nested:
- Solar System
- Star ?:: Sun
- Planet
- Earth ?:: Blue
- Mars ?:: Red
The headings for the nested lists become a part of the notes' paths:
| Question | Answer | Path |
|---|---|---|
| Star | Sun | Solar System |
| Earth | Blue | Solar System > Planet |
| Mars | Red | Solar System > Planet |
Math
If 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 --mathjax flag, pandoc will generate the correct markup,
using \( ... \) as delimeters for inline math, and \[ ... \] as
delimeters for display math:
$ pandoc --mathjax Note.md > Note.html
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ankivalenz-0.1.0.tar.gz.
File metadata
- Download URL: ankivalenz-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Linux/5.15.0-48-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a260d9bb5bb5f02412699117bff6e707c5456f1e0b206e79d9a81ce3fc42e3e
|
|
| MD5 |
38cead32c4eac49be061f55ce4370574
|
|
| BLAKE2b-256 |
771c3f339b5a534b319a45ee6a2a1f4c18f33f4cb597f4eed0a34811ae397a31
|
File details
Details for the file ankivalenz-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ankivalenz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Linux/5.15.0-48-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e256e6296e19678ef319a90db4c6d82cc42dddafd5eba711b336ba942c430478
|
|
| MD5 |
c85adc418457c7c3542f155a9e1e36ca
|
|
| BLAKE2b-256 |
1fb1df2690aa9dc23ab9d918a7fae9dcd8d1b99d45632d0a81ac868975c88366
|