Metadata-Version: 2.4
Name: notebooklm-to-anki
Version: 0.1.0
Summary: Convert Google NotebookLM flashcards and quizzes to Anki decks
Author: Diogenes Araujo
License-Expression: MIT
License-File: LICENSE
Keywords: anki,education,flashcards,notebooklm,spaced-repetition
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Education
Requires-Python: >=3.10
Requires-Dist: genanki>=0.13
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Provides-Extra: nlm
Requires-Dist: notebooklm-py>=0.3; extra == 'nlm'
Description-Content-Type: text/markdown

# notebooklm-to-anki

Convert Google NotebookLM flashcards and quizzes into Anki decks (.apkg) you can import and study with spaced repetition.

License: MIT

## What it does

Google NotebookLM can generate flashcards and quizzes from your study materials. This tool takes those exports (JSON files) and converts them into `.apkg` files that Anki can import -- so you get the best of both worlds: AI-generated questions + spaced repetition.

```mermaid
flowchart LR
    A[NotebookLM] -->|export or nlm-py| B[JSON]
    B -->|nlm2anki| C[.apkg]
    C -->|File > Import| D[Anki]
```

## Quick Start

```bash
pip install notebooklm-to-anki

# Convert a JSON file you already have
nlm2anki convert flashcards.json
```

That's it. Open Anki, go to **File > Import**, select the generated `.apkg` file, and start studying.

### Want to pull directly from NotebookLM?

```bash
pip install 'notebooklm-to-anki[nlm]'

notebooklm login
nlm2anki flashcards --all
```

## Features

- Converts **flashcards** (front/back) and **quizzes** (multiple choice with rationale)
- 3 built-in card themes: **dark** (Catppuccin Mocha), **light**, and **minimal**
- Optional category grouping via YAML config
- Works with local JSON files or directly with NotebookLM (via [notebooklm-py](https://github.com/sirdavidoff/notebooklm-py))
- Quiz cards show all options (A-Z) with correct/incorrect rationale on the back

## Usage

### Convert local files

**Flashcards:**

```bash
nlm2anki convert flashcards.json
```

**Quizzes:**

```bash
nlm2anki convert quiz.json
```

The output `.apkg` file is saved in the current directory.

### Download from NotebookLM

Download flashcards from all your notebooks:

```bash
nlm2anki flashcards --all
```

Download from a specific notebook:

```bash
nlm2anki flashcards --notebook "Biology 101"
```

### Choose a theme

```bash
nlm2anki convert flashcards.json --theme dark      # Catppuccin Mocha (default)
nlm2anki convert flashcards.json --theme light     # Clean light background
nlm2anki convert flashcards.json --theme minimal   # No styling, just text
```

### Organize by category

Create a `categories.yaml` file to group cards into sub-decks:

```yaml
Git Basics:
  - commit
  - branch
  - merge

SQL:
  - SELECT
  - JOIN
  - WHERE
```

Then pass it with `--categories`:

```bash
nlm2anki convert flashcards.json --categories categories.yaml
```

Cards whose content matches a keyword will be placed in the corresponding sub-deck.

## JSON Formats

### Flashcards

```json
[
  {
    "front": "What is spaced repetition?",
    "back": "A study technique where you review material at increasing intervals to improve long-term retention."
  }
]
```

### Quizzes

```json
[
  {
    "question": "Which planet is closest to the Sun?",
    "options": [
      {"letter": "A", "text": "Venus"},
      {"letter": "B", "text": "Mercury"},
      {"letter": "C", "text": "Earth"}
    ],
    "answer": "B",
    "rationale": "Mercury orbits at an average distance of 57.9 million km from the Sun, making it the closest planet."
  }
]
```

## Installation

**Basic** -- convert local JSON files only:

```bash
pip install notebooklm-to-anki
```

**With NotebookLM integration** -- download flashcards directly:

```bash
pip install 'notebooklm-to-anki[nlm]'
```

**For development:**

```bash
pip install 'notebooklm-to-anki[dev]'
```

Requires Python 3.10+.

## How it works

Under the hood, `nlm2anki` uses [genanki](https://github.com/kerrickstaley/genanki) to generate `.apkg` files.

- **Flashcards** become Anki **Basic** notes (front/back).
- **Quizzes** become cards with the question + options A-Z on the front, and the correct answer + rationale on the back.
- Plain text from NotebookLM is enriched with HTML formatting (inline code, SQL keywords, CLI commands) so cards look good in Anki.

## Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

```bash
git clone https://github.com/difrancesco/notebooklm-to-anki.git
cd notebooklm-to-anki
pip install -e '.[dev]'
pytest
```

## License

[MIT](LICENSE)
