KNN-07/Notebook2Anki

Export Gemini Notebook quizzes and flashcards to Anki via AnkiConnect, APKG, or CSV

โ˜… 7Forks 3JavaScriptGitHub โ†—Compare

README

Notebook2Anki

Notebook2Anki is a Chrome extension that exports Quizzes and Flashcards from Gemini Notebook (formerly NotebookLM) directly to Anki.

Features

  • ๐Ÿ“š Quiz Support: Export multiple-choice questions with hints, options, and rationales
  • ๐Ÿ—‚๏ธ Flashcard Support: Export simple front/back flashcards
  • โšก AnkiConnect Integration: Send cards directly to Anki (requires Anki open)
  • ๐Ÿ“ฆ APKG Export: Download as .apkg file (works offline, import anywhere)
  • ๐Ÿ“„ CSV Export: Export as CSV for manual import or other tools
  • ๐Ÿ”ข LaTeX/Math Support: Cards render mathematical notation via MathJax
  • ๐ŸŽจ Beautiful Dark Theme: Matching Gemini Notebook's aesthetic
  • ๐Ÿ”˜ UI Button Injection: Export button appears directly in Gemini Notebook

Installation

From Source (Developer Mode)

  1. Clone or download this repository
  2. Open Chrome and go to chrome://extensions/
  3. Enable "Developer mode" (toggle in top right)
  4. Click "Load unpacked"
  5. Select the Notebook2Anki folder

From Chrome Web Store

Coming soon

Usage

Method 1: Popup Menu (Recommended)

  1. Navigate to a notebook in Gemini Notebook
  2. Generate a Quiz or Flashcards using Gemini Notebook's features
  3. Click the extension icon in Chrome toolbar
  4. Choose your export method:
    • Send to Anki: Requires Anki desktop open with AnkiConnect
    • Download .apkg: Creates a portable Anki package file
    • Export CSV: Creates CSV files for quizzes and/or flashcards

Method 2: Injected Button

  1. When viewing quiz/flashcard content in Gemini Notebook, an "Anki Export" button appears
  2. Click the button to send directly to Anki via AnkiConnect

Requirements

For AnkiConnect Export

For APKG/CSV Export

  • No additional requirements (works in browser)

Anki Note Types

The extension creates two note types in Anki:

NotebookLM Quiz

15 fields for multiple-choice questions:

  • Question, Hint, ArchDiagram (for images)
  • Option1-4, Flag1-4 (True/False), Rationale1-4

NotebookLM Flashcard

2 fields for simple flashcards:

  • Front, Back

Both include dark theme styling and MathJax support.

Export Formats

AnkiConnect

  • Creates deck under NotebookLM:: parent deck
  • Creates note types automatically if missing
  • Best for direct integration

APKG File

  • Portable Anki package
  • Import on any device (desktop, mobile, AnkiWeb)
  • No Anki instance required during export

CSV

  • Universal format
  • Can import into Anki, Quizlet, or other tools
  • Separate files for quizzes and flashcards

Project Structure

Notebook2Anki/
โ”œโ”€โ”€ manifest.json           # Chrome extension manifest
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ background/         # Service worker for AnkiConnect
โ”‚   โ”œโ”€โ”€ content/            # Content scripts for UI injection
โ”‚   โ”œโ”€โ”€ popup/              # Extension popup UI
โ”‚   โ”œโ”€โ”€ lib/                # Shared utilities
โ”‚   โ””โ”€โ”€ templates/          # Anki card templates
โ”œโ”€โ”€ vendor/                 # Third-party libraries
โ”‚   โ”œโ”€โ”€ sql.js              # SQLite in browser
โ”‚   โ”œโ”€โ”€ jszip.min.js        # ZIP creation
โ”‚   โ”œโ”€โ”€ FileSaver.min.js    # File downloads
โ”‚   โ””โ”€โ”€ genanki.js          # Anki deck generation
โ””โ”€โ”€ icons/                  # Extension icons

Development

Building

No build step required. Load the extension directly in developer mode.

Testing

  1. Load extension in Chrome
  2. Navigate to Gemini Notebook
  3. Create quizzes/flashcards
  4. Test each export method

Credits

This project integrates functionality from:

Libraries Used

License

MIT License

Contributing

Contributions welcome! Please open an issue or pull request.

Troubleshooting

"Anki Not Found"

  • Make sure Anki Desktop is open
  • Verify AnkiConnect is installed: Tools โ†’ Add-ons โ†’ Check for "AnkiConnect"
  • AnkiConnect uses port 8765 by default

"0 Cards Added"

  • The note type might have field mismatches
  • Try deleting and recreating the note type in Anki
  • Or use APKG export which creates fresh note types

No content found

  • Make sure you've generated a Quiz or Flashcards in Gemini Notebook first
  • Refresh the page and try again
  • Some notebooks may have different data structures

Math not rendering

  • Make sure MathJax is configured in Anki
  • Cards use \(...\) for inline math and \[...\] for display math

Contributors

KNN-07

Issues