{"id":23741284,"url":"https://github.com/sgomezsal/typ2anki","last_synced_at":"2026-03-17T13:02:19.365Z","repository":{"id":270298383,"uuid":"907223928","full_name":"sgomezsal/typ2anki","owner":"sgomezsal","description":"Typ2Anki is a tool that converts Typst documents into Anki flashcards.","archived":false,"fork":false,"pushed_at":"2026-01-14T14:22:11.000Z","size":69201,"stargazers_count":36,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-14T17:59:46.647Z","etag":null,"topics":["anki","typst"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"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/sgomezsal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-23T05:37:02.000Z","updated_at":"2026-01-14T14:09:08.000Z","dependencies_parsed_at":"2024-12-30T20:54:24.071Z","dependency_job_id":"ecde5e22-146e-4308-8d23-dcfc0087bd37","html_url":"https://github.com/sgomezsal/typ2anki","commit_stats":null,"previous_names":["sgomezsal/typst2anki","sgomezsal/typ2anki"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sgomezsal/typ2anki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgomezsal%2Ftyp2anki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgomezsal%2Ftyp2anki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgomezsal%2Ftyp2anki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgomezsal%2Ftyp2anki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgomezsal","download_url":"https://codeload.github.com/sgomezsal/typ2anki/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgomezsal%2Ftyp2anki/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30624242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","typst"],"created_at":"2024-12-31T10:19:13.783Z","updated_at":"2026-03-17T13:02:19.357Z","avatar_url":"https://github.com/sgomezsal.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typ2Anki\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.youtube.com/watch?v=simotHOIWNQ\" target=\"_blank\" style=\"display: inline-block; position: relative; text-decoration: none;\"\u003e\n    \u003cimg src=\"https://img.youtube.com/vi/simotHOIWNQ/maxresdefault.jpg\" alt=\"Demo Video\" style=\"border: 2px solid #ccc; border-radius: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 600px; height: auto;\"\u003e\n  \u003c/a\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://www.youtube.com/watch?v=simotHOIWNQ\" target=\"_blank\" style=\"text-decoration: none; font-weight: bold; color: #0073e6;\"\u003e\n      ▶ Click to Watch the Demo Video on YouTube\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n**Typ2Anki** is a tool designed to integrate flashcard creation seamlessly into your Typst-based notes. By utilizing a custom Typst package, you can create cards directly in your notes and sync them effortlessly to a selected Anki deck. This enables you to transform study material into flashcards without disrupting your Typst workflow.\n\n- Create flashcards directly within your Typst documents.\n- Sync these flashcards to a chosen Anki deck effortlessly.\n- Streamlined workflow for note-taking and spaced repetition learning.\n\n---\n\n## Table of Contents\n\n1. **[Installation and Configuration](#installation-and-configuration)**\n\n   - [Installing AnkiConnect](#installing-ankiconnect)\n   - [Installing the Rust](#installing-the-rust-package)\n   - [Installing the Typst Package](#installing-the-typst-package)\n\n2. **[Usage](#usage)**\n\n   - [Basic Workflow](#basic-workflow)\n   - [Extra functionality and configuration](#extra-functionality-and-configuration)\n   - [Customizing Cards](#customizing-cards)\n   - [Example repositories](#example-repositories)\n\n3. **[Troubleshooting](#troubleshooting)**\n\n   - [Common Issues](#common-issues)\n\n4. **[Roadmap](#roadmap)**\n\n5. **[Future Plans](#future-plans)**\n\n6. **[Contributing](#contributing)**\n\n7. **[License](#license)**\n\n---\n\n## Installation and Configuration\n\n### Installing AnkiConnect\n\n1. Open Anki and navigate to **Tools \u003e Add-ons**.\n2. Click **Get Add-ons** and enter the following code to install AnkiConnect:\n\n   ```\n   2055492159\n   ```\n\n   Alternatively, visit the [AnkiConnect Add-on page](https://ankiweb.net/shared/info/2055492159) to learn more.\n3. Restart Anki to activate the add-on.\n4. Verify that AnkiConnect is running by visiting [http://localhost:8765](http://localhost:8765) in your browser. If it loads, the add-on is properly installed and functioning.\n\n---\n\n### Installing the Rust Package\n\n1. Install Rust and Cargo by following the instructions at [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install).\n2. Install the Typ2Anki package using cargo\n\n\u003e [!Note] It is recommended to get [cargo-binstall](https://github.com/cargo-bins/cargo-binstall) for faster installation, as the build process of typ2anki can take some time.\n\n```bash\ncargo binstall typ2anki --locked || cargo install typ2anki --locked\n```\n\n3. Verify the installation:\n\n   ```bash\n   typ2anki --help\n   ```\n\n#### Nix Flake\n\nOn systems with nix installed and flakes enabled, the\npython package can be executed with the following command:\n\n```sh\nnix run github:sgomezsal/typ2anki\n```\n\n---\n\n### Installing the Typst Package\n\n#### Method 1: Using Package Manager (Recommended)\n\n1. Add the Typ2Anki package to your Typst document:\n\n   ```typst\n   #import \"@preview/typ2anki:0.1.0\": *\n   ```\n\n#### Method 2: Using the Rust Package\n\n1. After installing the Rust package, you can run the following command to set up the Typst package:\n\n   ```bash\n   typ2anki --install-typst-pkg\n   ```\n\n2. Navigate to your flashcards directory:\n\n   ```bash\n   cd ~/Documents/Flashcards/  # or your preferred location\n   ```\n\n3. Create your `ankiconf.typ` file with basic configurations:\n\n   ```typst\n   // Custom imports for flashcards\n   #import \"@local/typ2anki:0.1.0\": *\n   #import \"@preview/pkgs\"\n\n   #let conf(\n     doc,\n   ) = {\n     // Custom configurations\n     doc\n   }\n   ```\n\n4. Create a new Typst document (e.g., `main.typ`):\n\n   ```typst\n   #import \"ankiconf.typ\": *\n   #show: doc =\u003e conf(doc)\n\n   #card(\n     id: \"001\",\n     target-deck: \"Target-Deck\",\n     q: \"Question\",\n     a: \"Answer\"\n   )\n   ```\n\n5. Run typ2anki in your project directory:\n\n   ```bash\n   typ2anki .\n   ```\n\n#### Method 3: Manual Installation\n\nIf you encounter issues with the package import, you can set up the package manually:\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/sgomezsal/typ2anki\n   cd typ2anki\n   ```\n\n2. Create the local package directory:\n\n   ```bash\n   mkdir -p ~/.local/share/typst/packages/local/typ2anki/0.1.0\n   ```\n\n3. Copy the package files (note the `-r` flag for recursive copy):\n\n   ```bash\n   cp -r src/ typst.toml ~/.local/share/typst/packages/local/typ2anki/0.1.0\n   ```\n\n4. Navigate to your flashcards directory:\n\n   ```bash\n   cd ~/Documents/Flashcards/  # or your preferred location\n   ```\n\n5. Create your `ankiconf.typ` file with basic configurations:\n\n   ```typst\n   // Custom imports for flashcards\n   #import \"@local/typ2anki:0.1.0\": *\n   #import \"@preview/pkgs\"\n\n   #let conf(\n     doc,\n   ) = {\n     // Custom configurations\n     doc\n   }\n   ```\n\n6. Create a new Typst document (e.g., `main.typ`):\n\n   ```typst\n   #import \"ankiconf.typ\": *\n   #show: doc =\u003e conf(doc)\n\n   #card(\n     id: \"001\",\n     target-deck: \"Target-Deck\",\n     q: \"Question\",\n     a: \"Answer\"\n   )\n   ```\n\n7. Run typ2anki in your project directory:\n\n   ```bash\n   typ2anki .\n   ```\n\n---\n\n## Usage\n\n### Basic Workflow\n\n1. Create a Typst file with flashcards:\n\n   ```typst\n   #import \"ankiconf.typ\": *\n   #show: doc =\u003e conf(doc)\n\n   #card(\n     id: \"001\",\n     target-deck: \"Typst\",\n     q: \"What is Typst?\",\n     a: \"A modern typesetting system.\"\n   )\n   ```\n\n2. Create your `ankiconf.typ` file with basic configurations:\n\n   ```typst\n   // Custom imports for flashcards\n   #import \"@preview/typ2anki:0.1.0\"\n   #import \"@preview/pkgs\"\n\n   #let conf(\n     doc,\n   ) = {\n     // Custom configurations that will run on the document\n     doc\n   }\n\n   // Any other global variables or settings can go here - they will be accessible in all cards\n   ```\n\n3. Use Typ2Anki to compile all files in the project directory:\n\n   ```bash\n   typ2anki ./path/to/your/project\n   ```\n\n4. Open your Anki deck to check the newly added flashcards.\n\n---\n\n### Extra functionality and configuration\n\n- **Command line options**: Do `typ2anki --help` to see all available options.\n  - Options include: specifying a max width for cards (to make sure they fit on phones - ex: `--max-card-width 430pt`), excluding files or decks\n- **Configuration file**: You can create a `typ2anki.toml` file in your project directory to customize the behavior of `typ2anki`. This file can include default command line options for the project, so you don't have to specify them every time you run the command.\n- **Compiling from .zip**: You can pass a `.zip` file to `typ2anki` to compile all Typst files inside it. This is useful so that if you use [typst.app](https://typst.app) you can download your project as a `.zip` and compile it with `typ2anki` without having to extract it first.\n\n---\n\n### Customizing Cards\n\nTo modify card appearance, you can define custom card logic:\n\n```typst\n#let custom-card(\n  id: \"\",\n  q: \"\",\n  a: \"\",\n  ..args\n) = {\n  card(\n    id: id,\n    q: q,\n    a: a,\n    container: true,\n    show-labels: true\n  )\n}\n```\n\n---\n\n### Example repositories:\n\n- See [examples](https://github.com/sgomezsal/typ2anki/tree/main/examples) for a few cards\n- Some math cards made using typ2anki: [itsvyle/typ2anki-demo](https://github.com/itsvyle/typ2anki-demo)\n\n---\n\n## Troubleshooting\n\n### Common Issues\n\n- **AnkiConnect not responding**:\n\n  - Ensure Anki is running and AnkiConnect is installed correctly.\n\n- **Typst file compilation errors**:\n  - Check for syntax issues in your Typst file.\n  - Ensure your `ankiconf.typ` contains the necessary imports and configurations.\n  - Do note that inside a given card you only have access to the scope that's in the current card. You cannot have any \"global\" variables in a given file. Any \"global\" or \"shared\" variables should be defined in the `ankiconf.typ` file.\n\n---\n\n## Roadmap\n\n1. **Command to Delete Cards**: Implement a feature to remove specific cards from Anki.\n2. **Efficiency Improvements**: Optimize the syncing process for speed and reliability.\n3. **Support for Other Card Types**: Expand compatibility to include more complex card formats.\n4. **Support to use what's previously been set in the file**: Allow using context from the file, and not just `ankiconf.typ`\n\n---\n\n## Future Plans\n\n- Enhance user experience with more robust error handling and syncing options.\n- Broaden integration with Typst to support various output formats.\n\n---\n\n## Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests for bug fixes, feature enhancements, or documentation improvements.\n\n---\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\nDeveloped with ❤️ by [sgomezsal](https://github.com/sgomezsal). Let’s make learning efficient and enjoyable!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgomezsal%2Ftyp2anki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgomezsal%2Ftyp2anki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgomezsal%2Ftyp2anki/lists"}