{"id":21706538,"url":"https://github.com/2anki/create_deck","last_synced_at":"2025-04-12T16:15:41.216Z","repository":{"id":38017647,"uuid":"502313620","full_name":"2anki/create_deck","owner":"2anki","description":"engine for creating Anki flashcards for 2anki.net","archived":false,"fork":false,"pushed_at":"2024-03-18T05:18:38.000Z","size":103,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-05-20T21:58:52.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2anki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["alemayhu"],"patreon":"alemayhu","ko_fi":"alemayhu","custom":["paypal.me/alemayhu"]}},"created_at":"2022-06-11T10:10:40.000Z","updated_at":"2024-08-01T20:20:37.537Z","dependencies_parsed_at":"2024-08-01T20:33:43.483Z","dependency_job_id":null,"html_url":"https://github.com/2anki/create_deck","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2anki%2Fcreate_deck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2anki%2Fcreate_deck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2anki%2Fcreate_deck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2anki%2Fcreate_deck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2anki","download_url":"https://codeload.github.com/2anki/create_deck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248594190,"owners_count":21130316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T22:13:06.200Z","updated_at":"2025-04-12T16:15:41.194Z","avatar_url":"https://github.com/2anki.png","language":"Python","funding_links":["https://github.com/sponsors/alemayhu","https://patreon.com/alemayhu","https://ko-fi.com/alemayhu","paypal.me/alemayhu"],"categories":[],"sub_categories":[],"readme":"# create_deck\n\nThis module is responsible for creating Anki flashcards for 2anki.net.\nYou can report issues in the [server](https://github.com/2anki/server/issues) repository.\n\n## API\n\nThe current implementation is CLI driven. [create_deck](./create_deck.py) is to\nbe executed with two arguments: absolute path to a JSON payload and template\ndirectory. Note that the working directory has to be the workspace directory (\nlocation of payload).\n\nHere is an example execution\n\n```bash\n$ cd /tmp/w/9dOax-Y1fhrsmZxPad5g5\n$ ./create_deck.py \\\n    /tmp/w/9dOax-Y1fhrsmZxPad5g5/deck_info.json\n    /Users/scanf/src/github.com/2anki/server/src/templates/\n```\n\nHere is the workspace directory (stripped long filenames)\nAs you can see above there are also media files in here. The APKG file is\ncreated based on the contents of deck_info.json.\n\n```\n/tmp/w/9dOax-Y1fhrsmZxPad5g5\n├── [...].png\n├── [...].apkg\n├── [...].jpg\n├── [...].png\n├── [...].jpg\n└── deck_info.json\n```\n\n### JSON Structure\n\nInside the deck_info.json is an array of decks.\n\n#### Deck\n\nThe deck object consists of settings (object), name (string), cards (array),\nimage (string), style (string):\nhttps://github.com/2anki/server/blob/main/src/lib/parser/Deck.ts\n\n```typescript\nclass Deck {\n  name: string;\n  cards: Note[];\n  image: string | undefined;\n  style: string | null;\n  id: number;\n  settings: Settings | null;\n}\n```\n\n#### Note\n\nThe note type here is not exactly the same as in Anki. It is a mix between\nflashcards, notes and other 2anki implementation details. create_deck will use\nthis structure to generate the flashcards.\n\nhttps://github.com/2anki/server/blob/main/src/lib/parser/Note.ts\n\n```typescript\nclass Note {\n  name: string;\n  back: string;\n  tags: string[];\n  cloze = false;\n  number = 0;\n  enableInput = false;\n  answer = '';\n  media: string[] = [];\n  notionId?: string;\n  notionLink?: string;\n}\n```\n\n#### Settings\n\nOne of the powerful things with 2anki is the flexibility it provides. With the\nsettings users can make new rules for what a flashcard is.\n\nhttps://github.com/2anki/server/blob/main/src/lib/parser/Settings.ts\n\n```typescript\ninterface TemplateFile {\n  parent: string;\n  name: string;\n  front: string;\n  back: string;\n  styling: string;\n  storageKey: string;\n}\n\nexport default class Settings {\n  readonly deckName: string | undefined;\n  readonly useInput: boolean;\n  readonly maxOne: boolean;\n  readonly noUnderline: boolean;\n  readonly isCherry: boolean;\n  readonly isAvocado: boolean;\n  readonly isAll: boolean;\n  readonly fontSize: string;\n  readonly isTextOnlyBack: boolean;\n  readonly toggleMode: string;\n  readonly isCloze: boolean;\n  readonly useTags: boolean;\n  readonly basicReversed: boolean;\n  readonly reversed: boolean;\n  readonly removeMP3Links: boolean;\n  readonly clozeModelName: string;\n  readonly basicModelName: string;\n  readonly inputModelName: string;\n  readonly clozeModelId: string;\n  readonly basicModelId: string;\n  readonly inputModelId: string;\n  readonly template: string;\n  readonly perserveNewLines: boolean;\n  readonly n2aCloze: TemplateFile | undefined;\n  readonly n2aBasic: TemplateFile | undefined;\n  readonly n2aInput: TemplateFile | undefined;\n  readonly useNotionId: boolean;\n  readonly addNotionLink: boolean;\n  readonly pageEmoji: string;\n  parentBlockId: string;\n}\n```\n\n## Roadmap\n\nTODO: flesh out the details here.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2anki%2Fcreate_deck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2anki%2Fcreate_deck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2anki%2Fcreate_deck/lists"}