{"id":15017338,"url":"https://github.com/krmanik/genanki-js","last_synced_at":"2025-04-12T11:43:33.488Z","repository":{"id":47018643,"uuid":"390530065","full_name":"krmanik/genanki-js","owner":"krmanik","description":"A JavaScript implementation for generating Anki decks in browser client side","archived":false,"fork":false,"pushed_at":"2023-03-12T20:26:53.000Z","size":2362,"stargazers_count":57,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T06:34:00.126Z","etag":null,"topics":["anki","anki-deck","anki-flashcards","csv-to-apkg","export-anki-deck","genanki","genanki-js","javascript"],"latest_commit_sha":null,"homepage":"https://genanki.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krmanik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-28T22:49:06.000Z","updated_at":"2025-02-20T06:32:06.000Z","dependencies_parsed_at":"2023-02-18T15:31:18.187Z","dependency_job_id":null,"html_url":"https://github.com/krmanik/genanki-js","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krmanik%2Fgenanki-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krmanik%2Fgenanki-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krmanik%2Fgenanki-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krmanik%2Fgenanki-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krmanik","download_url":"https://codeload.github.com/krmanik/genanki-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248564046,"owners_count":21125404,"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":["anki","anki-deck","anki-flashcards","csv-to-apkg","export-anki-deck","genanki","genanki-js","javascript"],"created_at":"2024-09-24T19:50:19.454Z","updated_at":"2025-04-12T11:43:33.466Z","avatar_url":"https://github.com/krmanik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# genanki-js\nA JavaScript implementation for generating Anki decks in browser. This is fork of [mkanki](https://github.com/nornagon/mkanki).\n\n# QuickStart\nDownload [genanki](https://github.com/krmanik/genanki-js/releases) zip file from release pages.\n\nThe zip file contains two folder\n\n- `dist` : This folder contains `genanki.js` file. If project already configured with [sql.js](https://github.com/sql-js/sql.js), [FileSaver.js](https://github.com/eligrey/FileSaver.js) and [JSZip](https://github.com/Stuk/jszip) then just add `genanki.js` file to project.\n\n- `sample` : This folder contains latest [sql.js](https://github.com/sql-js/sql.js), [FileSaver.js](https://github.com/eligrey/FileSaver.js), [JSZip](https://github.com/Stuk/jszip) and [genanki.js](https://github.com/krmanik/genanki-js). It is ready to use folder. \n\nAlternatively, `genanki.js` can also be loaded from CDN.\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/krmanik/genanki-js/dist/genanki.js\"\u003e\u003c/script\u003e\n```\n\n# Documentation\nView [Documentation](https://krmanik.github.io/genanki-js/#/)\n\n# CSV/TSV to Anki Package\nVisit page and select `CSV to APKG` from top menu.\u003cbr\u003e\n[CSV to APKG](https://krmanik.github.io/genanki-js/demo/index.html#)\n\n# Set Up a new project from scratch\n1. Download `genanki.js` from `dist` folder and add to the project\n```html\n\u003c!-- for creating and exporting anki package file --\u003e\n\u003cscript src='genanki.js'\u003e\u003c/script\u003e\n```\n\n2. Add [sql.js](https://github.com/sql-js/sql.js), [FileSaver.js](https://github.com/eligrey/FileSaver.js) and [JSZip](https://github.com/Stuk/jszip) to the project\n\n    \u003e*Note: [mkanki](https://github.com/nornagon/mkanki) uses `better-sql`, `fs` and `archiver`, that make it difficult to be used in browser*\n\n```html\n\u003c!-- sqlite --\u003e\n\u003cscript src='js/sql/sql.js'\u003e\u003c/script\u003e\n\n\u003c!-- File saver --\u003e\n\u003cscript src=\"js/filesaver/FileSaver.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- jszip for .apkg --\u003e\n\u003cscript src=\"js/jszip.min.js\"\u003e\u003c/script\u003e\n```\n\n3. Create a `SQL` global variable (may be added to index.js)\n```js\n// The `initSqlJs` function is globally provided by all of the main dist files if loaded in the browser.\n// We must specify this locateFile function if we are loading a wasm file from anywhere other than the current html page's folder.\nconfig = {\n    locateFile: filename =\u003e `js/sql/sql-wasm.wasm`\n}\n\nvar SQL;\ninitSqlJs(config).then(function (sql) {\n    //Create the database\n    SQL = sql;\n});\n```\n\n4. Now use following `Examples` to generate and export decks.\n\n*View more examples here [Examples](https://krmanik.github.io/genanki-js/#/examples)*\n\n# Examples\n```js\nvar m = new Model({\n  name: \"Basic (and reversed card)\",\n  id: \"1543634829843\",\n  flds: [\n    { name: \"Front\" },\n    { name: \"Back\" }\n  ],\n  req: [\n    [ 0, \"all\", [ 0 ] ],\n    [ 1, \"all\", [ 1 ] ]\n  ],\n  tmpls: [\n    {\n      name: \"Card 1\",\n      qfmt: \"{{Front}}\",\n      afmt: \"{{FrontSide}}\\n\\n\u003chr id=answer\u003e\\n\\n{{Back}}\",\n    },\n    {\n      name: \"Card 2\",\n      qfmt: \"{{Back}}\",\n      afmt: \"{{FrontSide}}\\n\\n\u003chr id=answer\u003e\\n\\n{{Front}}\",\n    }\n  ],\n})\n                        \nvar d = new Deck(1276438724672, \"Test Deck\")\n\nd.addNote(m.note(['this is front', 'this is back']))\n\nvar p = new Package()\np.addDeck(d)\n\np.writeToFile('deck.apkg')\n```\n\n# License\n### [genanki-js](https://github.com/krmanik/genanki-js)\n[GNU Affero General Public License v3](https://opensource.org/licenses/AGPL-3.0)\n\u003cbr\u003eCopyright (c) 2021 Mani\n\n## Other Third Party Licenses\n[License.md](https://github.com/krmanik/genanki-js/blob/master/License.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrmanik%2Fgenanki-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrmanik%2Fgenanki-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrmanik%2Fgenanki-js/lists"}