Skip to main content

A CLI tool for compiling Anki decks, defined in Markdown

Project description

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.
  • ankc check validates decks without compiling. It reports problems as file:line, and can print JSON with --format json.
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankcompiler-0.3.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ankcompiler-0.3.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file ankcompiler-0.3.0.tar.gz.

File metadata

  • Download URL: ankcompiler-0.3.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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}

File hashes

Hashes for ankcompiler-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b24cd3a77d8a76814aa2e0d99a9b90eb7011dda7524e80217be37c46835198b9
MD5 06e5193724264f366c70041663fd6343
BLAKE2b-256 92a47b992b0ce4d4424da332f3a01a4016c090ddc695555d3838b71408381573

See more details on using hashes here.

File details

Details for the file ankcompiler-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ankcompiler-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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}

File hashes

Hashes for ankcompiler-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28635ffeb8febfe39c6e16a41020b6dcf2d1ce9ed3fb7d26404b228afdc0cabd
MD5 a2120a4952d6bb5afff13fa06047c668
BLAKE2b-256 9417336edb72eff5c5bce3aabeeb8fc7b614fbd230ed21e62c49ec19b13b8866

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page