# ExDocAnki
[](https://hex.pm/packages/ex_doc_anki)
[](https://github.com/abreujp/ex_doc_anki/actions/workflows/ci.yml)
Generate Anki flashcards from any Elixir project's documentation using ExDoc.
## What it does
ExDocAnki transforms API documentation into Anki-compatible CSV flashcards for studying through spaced repetition.
For each function, type and callback, ExDocAnki generates a card with:
- **Front**: `Module.function/arity` (e.g., `Enum.map/2`)
- **Back**: Documentation, type spec, and code examples
## Usage
Add to your project's `mix.exs` as a dev dependency:
```elixir
def deps do
[
{:ex_doc_anki, "~> 0.1.0", only: :dev, runtime: false}
]
end
```
> **Note**: If you already have `ex_doc` as a dependency, remove `only: :dev` from it:
>
> ```elixir
> # Before
> {:ex_doc, "~> 0.40", only: :dev, runtime: false}
>
> # After
> {:ex_doc, "~> 0.40", runtime: false}
> ```
>
> ExDocAnki needs ExDoc at compile time, and Hex requires all dependencies
> to use the same `:only` option. Mix will warn you about this if needed.
Then run:
```bash
# Generate cards for your project
mix doc_anki
# Generate cards for a dependency (even transitive)
mix doc_anki ecto
mix doc_anki phoenix ecto ecto_sql
```
The CSV is generated at `doc/anki_cards.csv` (project) or `doc/<package>/anki_cards.csv` (dependency).
## Importing into Anki
1. Open Anki and create a new deck
2. Go to **File → Import** and select the `anki_cards.csv` file
3. Set **Field separator** to **Semicolon**
4. Map the first column to **Front** and the second column to **Back**
5. Select your deck and click **Import**
## Options
- `-o`, `--output` - Output directory (default: `doc`)
- `--no-compile` - Skip compilation before generating
## How it works
ExDocAnki uses `ExDoc.generate/4` under the hood, passing `ExDocAnki.Formatter` as the formatter module. It extracts:
- **Function cards** — `Module.function/arity` + doc, spec and examples
- **Type cards** — `Module.type()` + type specification
- **Callback cards** — `Module.callback/arity` + callback specification
## License
MIT