Skip to main content

inka2

Downloads PyPi Tests CI Codecov

Automatically extract flashcards from Markdown to Anki.

too useful to let it be unsupported :-)

Installation

Install inka2:

python3 -m pip install inka2 --upgrade

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.

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

Features

nvim Integration

For better card management in your markdown files the inka-nvim plugin might be helpful.

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.

⚠️ This means that you should avoid using the --- syntax anywhere else in the file for inka2 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). inka2 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

inka2 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:

inka2 collect path/to/cards.md

Or from all Markdown files in a directory:

inka2 collect path/to/directory

You can also pass multiple paths at once:

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

You can find more information on the documentation page.

Configuration

inka2 can be customized via a config.ini file. Key configuration options include:

Styling Options

[highlight]
style = monokai                    # Syntax highlighting theme
inline_code_color = #8b5cf6        # Inline code color (default: #fa4545)

The inline_code_color option allows you to customize the color of inline code elements in your Anki cards. You can use any valid CSS color value (hex, rgb, named colors, etc.).

For complete configuration options, see the Config documentation.

Metadata

Release files for inka2 3.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inka2 3.2.2
File Size Uploaded Provenance
inka2-3.2.2.tar.gz 53.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for inka2 3.2.2
File Interpreter ABI Platform
inka2-3.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 96.6 kB

Release files / inka2-3.2.2.tar.gz

Download URL inka2-3.2.2.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d1651b76a06af0e12d5067ce91159327b96eea560d3eeef0e3f7f871710a5623
BLAKE2b-256 checksum
How to use checksums
85dcff2c169f98374a17fe31947dcde781f883b3b9a01721d6e2f43126ce4525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / inka2-3.2.2-py3-none-any.whl

Download URL inka2-3.2.2-py3-none-any.whl
Size 43.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d2a0cbcde0983d1e5abe2e96b92b8504bd04883df8e98d7236aebf19d54d3a0
BLAKE2b-256 checksum
How to use checksums
9881d37746cf59e5508165439749beefa3f2d131c654ee8b526f5cebd5975aea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for inka2 3.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page