ExDocAnki
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:
def deps do
[
{:ex_doc_anki, "~> 0.1.0", only: :dev, runtime: false}
]
endNote: If you already have
ex_docas a dependency, removeonly: :devfrom it:# 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
:onlyoption. Mix will warn you about this if needed.
Then run:
# 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
- Open Anki and create a new deck
-
Go to File → Import and select the
anki_cards.csvfile - Set Field separator to Semicolon
- Map the first column to Front and the second column to Back
- 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