AnkCompiler
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 buildcompiles decks into.apkgpackages.- Subdecks use Anki's
::naming, e.g.deck: Geo::Rivers.--deck GeopackagesGeoand everyGeo::...subdeck into onegeo.apkg.--allwrites 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.
- To set the order yourself, add a
[^pos]: <n>footnote next to a card's[^uid].<n>is a whole number from 0 to 999999, and lower numbers are studied first. All cards from one note (both sides of a reversed note, every cloze) share its position. Within a package (the deck and subdecks oneankc buildwrites), use[^pos]on every card or on none. Mixing the two is an error, and so is a position used twice. A package with no[^pos]keeps the source order above.ankc checkreports these errors asfile:line.ankc uidandankc uid --fixkeep[^pos]lines.
- Subdecks use Anki's
- 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 astier::1). ankc checkvalidates decks without compiling. It reports problems asfile:line, and can print JSON with--format json. It also fails on missing images and on two different images sharing a filename.ankc uidadds a[^uid]footnote to any card block that is missing one. It is append-only and safe to run more than once. Use--checkfor a dry run. It will not touch files with uncommitted git changes unless you pass--force.- Add
--fixto 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 runankc uid --fixto make the deck buildable. It only restructures real decks (frontmatter with adeck:key), so it is safe on non-drafts.
- Add
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 ::: backplus[^type]: reversed. This makes a card in both directions. - Type in the answer:
question ::: answerplus[^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.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ankcompiler-0.6.0.tar.gz | 21.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ankcompiler-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.3 kB
Release files / ankcompiler-0.6.0.tar.gz
| Download URL | ankcompiler-0.6.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71b150fb4b38d18fe829fe9a48ffbe2913ff32719860cf0e7a9a0dd0a887b2c6
|
|
BLAKE2b-256 checksum How to use checksums |
0698ac2b8cbfe8322ac1eb394ffd47a3bc37a3be862b88724c93731c4420ae40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.6.0-py3-none-any.whl
| Download URL | ankcompiler-0.6.0-py3-none-any.whl |
|---|---|
| Size | 27.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f545d6fd2db5b071afb1472f3077e20b071827dda2c2acb2952e18f5f2236dc
|
|
BLAKE2b-256 checksum How to use checksums |
67c715cf1d84bc83ae57e09a9dd7196f99d33e807f4892eb2245173579c8cd7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.6.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.