Skip to content

Small project that automatically generates Anki format flashcards for a given Notion page

Notifications You must be signed in to change notification settings

tonserrobo/flashygen

Repository files navigation

FlashyGen

Generate Anki flashcards from Notion pages using AI.

Automatically creates diverse flashcards with proper syntax highlighting for code examples, supporting both local (Ollama) and cloud (Claude) AI providers.

Features

  • AI-powered flashcard generation (Ollama or Claude)
  • Multiple question types: recall, conceptual, application, comparison, command
  • Syntax-highlighted code blocks
  • Works with private Notion pages
  • Clean, styled Anki decks ready to import

Installation

git clone https://github.com/yourusername/flashygen.git
cd flashygen
uv sync  # or: pip install -r requirements.txt

Quick Setup

  1. Choose AI Provider

  2. Create Notion Integration

  3. Configure

    cp .env.example .env
    # Edit .env and add your tokens
  4. Share Notion Pages

    • Open your Notion page → "..." menu → "Add connections" → Select your integration

For detailed setup help, run:

python main.py setup

Usage

Basic:

python main.py generate https://www.notion.so/your-page-url

Options:

--provider, -p     # AI provider: "ollama" (default) or "claude"
--output, -o       # Output file path (default: page_title.apkg)
--cards, -c        # Cards per concept (default: 3)
--deck-name, -d    # Custom deck name (default: page title)

Examples:

# Use Claude instead of Ollama
python main.py generate <url> -p claude

# Custom output with more cards
python main.py generate <url> -o my-deck.apkg -c 5

# All options
python main.py generate <url> -p claude -o deck.apkg -c 4 -d "Python Study"

Troubleshooting

"Configuration error: ANTHROPIC_API_KEY not found"

  • Create .env file and add your API key without quotes

"Error fetching page: Could not find page"

  • Share the Notion page with your integration (see setup step 4)

"No flashcards were generated"

  • Page may be empty or have insufficient content

Generated .apkg file not working

  • Install Anki, then double-click .apkg or import via File → Import

License

MIT License - see LICENSE file for details

About

Small project that automatically generates Anki format flashcards for a given Notion page

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages