Skip to main content

AnkCompiler

coverage

A CLI tool for compiling Anki decks, defined in Markdown.

Installation

Run pip install ankcompiler

Usage

Run ankc --help for usage information.

Main commands:

  • ankc build compiles decks into .apkg packages.
    • Subdecks use Anki's :: naming, e.g. deck: Geo::Rivers. --deck Geo packages Geo and every Geo::... subdeck into one geo.apkg. --all writes one package per top-level deck. Upgrading from 0.3.x: delete old per-subdeck packages (e.g. geo--rivers.apkg) from your output directory so they aren't re-imported.
    • New cards are studied in source order: by deck name, then file path, then position in the file. Anki applies this order to cards it imports for the first time; it doesn't reorder cards already in a collection.
  • Tags: tags: in the frontmatter applies to every card in a file, and a [^tag]: <tag> footnote applies to one card. Footnote tags may use letters, digits, _, - and :: (a hierarchical tag such as tier::1).
  • ankc check validates decks without compiling. It reports problems as file:line, and can print JSON with --format json. It also fails on missing images and on two different images sharing a filename.
  • ankc uid adds a [^uid] footnote to any card block that is missing one. It is append-only and safe to run more than once. Use --check for a dry run. It will not touch files with uncommitted git changes unless you pass --force.
    • Add --fix to also repair a draft deck whose cards are separated by a single ---. It rewrites each card into a well-formed block and stamps any missing uids. Draft fast, then run ankc uid --fix to make the deck buildable. It only restructures real decks (frontmatter with a deck: key), so it is safe on non-drafts.

Examples

See examples/example.md for a deck with every note type, tags, and math.

Note types

  • Question and answer: front ::: back. Found automatically.
  • Cloze: {{c1:: ...}}. Found automatically.
  • Basic and reversed: front ::: back plus [^type]: reversed. This makes a card in both directions.
  • Type in the answer: question ::: answer plus [^type]: type-in.

Reversed and type-in cards use the same ::: syntax as a question and answer card. So you name them with a [^type] footnote next to the [^uid].

Math

Write inline math as $...$ and block math as $$...$$. Anki renders it with MathJax. To show a real dollar sign, write \$.

Credits

Inspiration taken from lukesmurry

Metadata

Release files for ankcompiler 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ankcompiler 0.5.0
File Size Uploaded Provenance
ankcompiler-0.5.0.tar.gz 19.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ankcompiler 0.5.0
File Interpreter ABI Platform
ankcompiler-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.7 kB

Release files / ankcompiler-0.5.0.tar.gz

Download URL ankcompiler-0.5.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
56ef5fb93ed134ed36f5aae7425a5150c8fbcdfa4ff6ecc14ab5636bbb1b76a5
BLAKE2b-256 checksum
How to use checksums
173f2810727183e6484e0506cadf2db657c66db7f8c26826ed9469800a00e27f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ankcompiler-0.5.0-py3-none-any.whl

Download URL ankcompiler-0.5.0-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35364d32bb4f2556014577352945926c2c58e918b53e2fe6f792a6907bc7712b
BLAKE2b-256 checksum
How to use checksums
9eac5d986c09565cd19400696d786cffc7996f52200deac4062fe14ae2f93058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ankcompiler 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page