Skip to main content

Command-line tool for adding flashcards from Markdown files to Anki

Project description

inka

Downloads PyPi Tests CI Code style: black Codecov

Automatically add your Markdown flashcards to Anki.

Installation

Install inka:

python3 -m pip install inka --upgrade

You also need to install aqt package if not already installed (on some systems it is installed as a part of Anki). You can check if you have it with the command pip show aqt. If you don't have it, install it using the command (replace 2.1.49 with your version of Anki):

python3 -m pip install aqt==2.1.49

Requirements

Why

I've been using Anki for a long time, and at some point my notes turned into just lists of question/answer pairs, from which I then created Anki cards. The process of creating flashcards in Anki took a long time, so I decided to write a Python script to automate it. With more and more features added, the script has evolved into the command-line tool you can see now.

inka allows you to use full power of Markdown when creating flashcards. The program is also extensively tested.

Features

Usage

Creating Cards

In order for the program to be able to separate cards from all the rest of the text in the file, you need to enclose them between two ---:

---

Deck: Life Questions

Tags: learning life-questions

1. What is the answer to the Ultimate Question of Life, the Universe, and Everything?

> 42

2. If it {{c1::looks like a duck, swims like a duck, and quacks like a duck}}, then it is a {{c2::duck}}.

---

You can create any number of such sections in the file.

:warning: This means that you should avoid using the --- syntax anywhere else in the file for inka to work correctly. There are exceptions, and you can read about them in documentation.

Inside the section, you can specify the name of the deck to which the cards will be added, and tags for the cards. If deck name isn't specified, then the one from the config is used (Default by default). The deck name is written after Deck:, and tags for all cards after Tags: with spaces between each tag.

Two types of notes are supported:

  • Front/Back: every question starts with number followed by period (e.g. 1., 2. - Markdown ordered list syntax) and every line of the answer starts with > (Markdown quote syntax). Question and answer can span multiple lines.
  • Cloze: same as Front/Back notes, Cloze notes start with number followed by period (Markdown ordered list syntax). inka supports three versions of syntax for cloze deletions:
    • Anki syntax: {{c1::hidden text}}
    • Short explicit syntax: {1::hidden text} or {c1::hidden text}
    • Short implicit syntax: {hidden text}

More info and examples on the creating cards documentation page.

Adding Cards to Anki

inka will create custom note types for Front/Back and Cloze notes. If you want to use different ones, you can change note types in the config.

Add cards from the file:

inka collect path/to/cards.md

Or from all Markdown files in a directory:

inka collect path/to/directory

You can also pass multiple paths at once:

inka collect path/to/cards.md path/to/folder

You can find more information on the documentation page.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inka-2.1.0.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inka-2.1.0-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file inka-2.1.0.tar.gz.

File metadata

  • Download URL: inka-2.1.0.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for inka-2.1.0.tar.gz
Algorithm Hash digest
SHA256 7abe016b8b1175946b5bfa636a343b8ee3ad460ce1d08ff2efd1e0304c685669
MD5 fa93b6c33874b4d3c2988ff138a86f50
BLAKE2b-256 087f3a9b65010055989c0d07000f42361b2a0b4a442b10f035bcce1888f5fbcb

See more details on using hashes here.

File details

Details for the file inka-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: inka-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for inka-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c869a192492077c5478c6599d52bd4d40c5457fb8985b7435b242007f3c79e4c
MD5 a9a11c7395ad7b488892b98562b6eb94
BLAKE2b-256 bd748768f69686a95590ed8696068ef6b3d497d27ea682189fbebe70d967efb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page