{"id":13394212,"url":"https://github.com/ashlinchak/mdanki","last_synced_at":"2025-05-16T02:07:23.897Z","repository":{"id":41151514,"uuid":"239616637","full_name":"ashlinchak/mdanki","owner":"ashlinchak","description":"Markdown to Anki converter","archived":false,"fork":false,"pushed_at":"2024-07-04T09:19:10.000Z","size":366,"stargazers_count":863,"open_issues_count":23,"forks_count":48,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-09T10:53:20.043Z","etag":null,"topics":["anki","markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashlinchak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-02-10T21:25:56.000Z","updated_at":"2025-05-09T02:45:24.000Z","dependencies_parsed_at":"2024-01-14T06:54:04.998Z","dependency_job_id":"15038675-d434-4a11-9619-3e5637a813e6","html_url":"https://github.com/ashlinchak/mdanki","commit_stats":{"total_commits":28,"total_committers":7,"mean_commits":4.0,"dds":0.6785714285714286,"last_synced_commit":"acbad247a1fcc02ac6a3ecbf37e4c0f93b1d8576"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashlinchak%2Fmdanki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashlinchak%2Fmdanki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashlinchak%2Fmdanki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashlinchak%2Fmdanki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashlinchak","download_url":"https://codeload.github.com/ashlinchak/mdanki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453652,"owners_count":22073617,"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","markdown"],"created_at":"2024-07-30T17:01:12.640Z","updated_at":"2025-05-16T02:07:23.874Z","avatar_url":"https://github.com/ashlinchak.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","📦 Others (实用工具、媒体与其它)"],"sub_categories":[],"readme":"# MDAnki\n\nConverts Markdown file(s) to the Anki cards.\n\n- [MDAnki](#mdanki)\n  - [Requirements](#requirements)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Overriding default settings](#overriding-default-settings)\n  - [Supported files](#supported-files)\n  - [Cards](#cards)\n  - [Tags](#tags)\n  - [Code and syntax highlighting](#code-and-syntax-highlighting)\n  - [Supported languages](#supported-languages)\n  - [Images](#images)\n  - [LaTeX](#latex)\n  - [Memory limit](#memory-limit)\n  - [License](#license)\n  - [Changelog](#changelog)\n\n## Requirements\n\nNode.js v10.0+\n\n## Install\n```bash\nnpm install -g mdanki\n```\n\n## Usage\n\nConvert a single markdown file:\n\n```bash\nmdanki library.md anki.apkg\n```\n\nConvert files from directory recursively:\n\n```bash\nmdanki ./documents/library ./documents/anki.apkg\n```\n\nUsing all available options:\n\n```bash\nmdanki library.md anki.apkg --deck Library --config config.json\n```\n\nImport just generated `.apkg` file to Anki (\"File\" - \"Import\").\n\n## Overriding default settings\n\nTo override [default settings](./src/configs/settings.js) use `--config` option:\n\n```bash\nmdanki library.md anki.apkg --config faworite-settings.json\n```\n\nThe JSON file, for example, would look like the following if you were to change\nthe mdanki card template to the default that Anki has:\n\n```json\n{\n\"template\": {\n    \"formats\": {\n        \"question\": \"{{Front}}\",\n        \"answer\"  : \"{{FrontSide}}\\n\\n\u003chr id=\\\"answer\\\"\u003e\\n\\n{{Back}}\",\n         \"css\"     : \".card {\\n font-family: arial;\\n font-size: 20px;\\n text-align: center;\\n color: black;\\n background-color: white;\\n}\"\n               }\n            }\n}\n```\n\n\n## Supported files\n\nMDAnki supports `.md` and `.markdown` files.\n\n## Cards\n\nBy default, MDAnki splits cards by `## ` headline. For example, below markdown will generate 2 cards where headlines will be on the front side and its description - on the back.\n\n```\n## What's the Markdown?\n\nMarkdown is a lightweight markup language with plain-text-formatting syntax.\nIts design allows it to be converted to many output formats,\nbut the original tool by the same name only supports HTML.\n\n## Who created Markdown?\n\nJohn Gruber created the Markdown language in 2004 in collaboration with\nAaron Swartz on the syntax.\n\n```\n\nIf you want to have multiple lines on the card's front side - use `%` symbol for splitting front and back sides:\n\n```\n## YAGNI\n\nDescribe this acronym and why it's so important.\n\n%\n\n\"You aren't gonna need it\" (YAGNI) is a principle of extreme programming\n(XP) that states a programmer should not add functionality until deemed\nnecessary.\n\n```\n\nWhen parsing only one markdown file, the title of the deck could be generated based on the top-level headline (`# `).\n\n## Tags\n\nCards can have tags in their markdown sources. For adding tags to cart it should follow some rules:\n* tags start from a new line\n* only one line with tags per card\n* a tag should be written in the link format\n* tag (link text) should start from `#` symbol\n\nMDAnki uses `'^\\\\[#(.*)\\\\]'` pattern for searching tags. This pattern could be overwritten by specifying custom settings. The source file in the tag link is optional.\n\nThe below example will generate a card with 3 tags: _algorithms_, _OOP_, and _binary_tree_.\n\n```\n## Binary tree\n\nIn computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.\n\n[#algorithms](./algorityms.md) [#OOP]() [#binary tree]()\n```\n\n## Code and syntax highlighting\n\nCode blocks can be written with and without specifying a language name:\n\n\u003cpre\u003e\n```java\npublic static void main(String[] args) {\n  System.out.println(\"Hello, World!\");\n}\n```\n\u003c/pre\u003e\n\u003cpre\u003e\n```\necho \"Hello, World!\"\n```\n\u003c/pre\u003e\n\nThe last code block will be treated by MDAnki as Bash code. The default language can be configured by specifying `--config` with an appropriate **defaultLanguage** [setting](../src/configs/settings.js).\n\n**Note!** Creating a block without language name is not fully supported and should be eliminated in usage. Take a look at this:\n```bash\necho \"Code block with language name\"\n```\n```\necho \"Code block without language name\"\n```\n\n## Supported languages\n\nMDAnki supports code highlighting for these languages:\n\n\u003e actionscript, applescript, aspnet, bash, basic, batch, c, coffeescript, cpp, csharp, d, dart, erlang, fsharp, go, graphql, groovy, handlebars, java, json, latex, less, livescript, lua, makefile, markdown, markup-templating, nginx, objectivec, pascal, perl, php, powershell, python, r, ruby, rust, sass, scheme, smalltalk, smarty, sql, stylus, swift, typescript, vim, yaml.\n\n\n## Images\n\nYou can use links to image files inside markdown, MDAnki will parse them and add those images to the import collection. It's allowed to use two styles for writing images:\n\n1. Inline:\n![alt text](samples/resources/nodejs.png \"Node.js\")\n\n1. Reference:\n![alt text][ROR]\n\n[ROR]: samples/resources/ruby_on_rails.png \"Logo Title Text 2\"\n\n## LaTeX\n\nMDAnki and Anki can support LaTeX. Install LaTeX for your OS and use the `[latex]` attribute within Markdown files.\n\n```\n[latex]\\\\[e^x -1 = 3\\\\][/latex]\n```\n\n## Memory limit\n\nConverting a big Markdown file you can get a memory limit error like this:\n\n\u003e Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 16777216...\n\nFor overcoming this error, replace `sql.js`:\n\n```bash\ncp node_modules/sql.js/js/sql-memory-growth.js node_modules/sql.js/js/sql.js\n```\n\nMore info [here](https://github.com/sql-js/sql.js#versions-of-sqljs-included-in-the-distributed-artifacts).\n\n## License\nMIT License, Copyright (c) 2020, Oleksandr Shlinchak.\n\n## Changelog\n[Changelog](./CHANGELOG.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashlinchak%2Fmdanki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashlinchak%2Fmdanki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashlinchak%2Fmdanki/lists"}