9dogs / notion-anki-sync

Sync Notion toggle lists to Anki cards.
GNU General Public License v3.0
55 stars 8 forks source link

Ankiđź’—Notion addon

It's an Anki addon that loads toggle lists from Notion as notes to a specified deck.

Supported versions License: GPL v3 Codestyle: Black

How it works

Short demo and configuration how-to: YouTube link

TLDR

Clozes can be added via code blocks in toggle titles. Backside will be ignored (apart from tags).

Synchronization can work in the background or can be triggered manually from the Notion submenu in the Tools section. Note that background sync does not remove any notes; if you want to remove the obsolete notes, then trigger Load and remove obsolete from the submenu.

Requirements

Notion API token

To get Notion API token log in to Notion via a browser (assuming Chrome here), then press Ctrl+Shift+I to open Developer Tools, go to the "Application" tab and find token_v2 under Cookie on the left.

Notion page ids

To get Notion page id open up the page in a browser and look at the address bar. 32 chars of gibberish after a page title is the page id: https://www.notion.so/notion_user/My-Learning-Book-8a775ee482ab43732abc9319add819c5 ➡ 8a775ee482ab43732abc9319add819c5

Edit plugin config file from Anki: Tools ➡ Add-ons ➡ Notion Toggles Loader ➡ Config

{
  "debug": false,
  "sync_every_minutes": 30,
  "anki_target_deck": "Notion Sync",
  "notion_token": "<your_notion_token_here>",
  "notion_namespace": "<your_notion_username_here",
  "notion_pages": [
    {
      "page_id": "<page_id1>",
      "recursive": false
    },
    {
      "page_id": "<page_id2>",
      "recursive": true
    }
  ]
}

Known issues & limitations

Behind the scenes, the addon initiates Notion pages export to HTML, then parses the HTML into notes. Since non-public Notion API is used, the addon may break without a warning.

Configuration parameters

Inspiration

This project is inspired by a great Notion to Anki.