Anknote¶
Anknote is a command-line tool that automatically generates Anki flashcards from your markdown notes using AI models. Transform your study materials into effective spaced repetition cards with minimal effort.
Features¶
- ๐ค AI-Powered Generation: Uses LiteLLM to support multiple AI models (OpenAI, Anthropic, Google, etc.)
- ๐ Markdown Processing: Automatically processes markdown files and directories
- โ๏ธ Configurable: Flexible configuration via files, CLI arguments, and environment variables
- ๐ Batch Processing: Process multiple files at once with progress tracking
- ๐ TSV Output: Generates Anki-compatible TSV files for easy import
- ๐ก๏ธ Robust: Built-in error handling, retry logic, and validation
- ๐งช Well-Tested: Comprehensive test suite with 100% coverage
Quick Start¶
Installation¶
Recommended: Use uvx (uv tool) for the best experience:
This runs Anknote without permanent installation. For regular use, you can also install with pip:
Command Line Usage¶
Set up your AI API key first:
# For OpenAI (recommended for beginners)
export OPENAI_API_KEY="your-openai-api-key-here"
# Or for Anthropic Claude
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"
Generate flashcards from a single markdown file:
Process an entire directory of markdown files:
# Using uvx
uvx anknote notes/ -o flashcards/
# Or if installed with pip
anknote notes/ -o flashcards/
The generated .tsv
files can be directly imported into Anki!
How It Works¶
- Extract Content: Anknote reads your markdown files and extracts the content
- AI Processing: The content is sent to an AI model with a carefully crafted prompt
- Parse Cards: The AI response is parsed to extract question-answer pairs
- Generate TSV: Cards are saved in Anki-compatible TSV format for import
Example¶
Given a markdown file like this:
# Python Basics
Python is a high-level programming language. It was created by Guido van Rossum
and released in 1991. Python emphasizes code readability and uses significant
indentation.
## Key Features
- Interpreted language
- Dynamic typing
- Object-oriented programming
Anknote generates flashcards like:
- Q: What is Python? A: A high-level programming language created by Guido van Rossum
- Q: When was Python released? A: 1991
- Q: What does Python emphasize? A: Code readability and uses significant indentation
Next Steps¶
- Installation Guide - Detailed installation instructions
- Usage Guide - Learn all the command-line options
- Configuration - Customize Anknote for your workflow
- API Reference - Complete API documentation