md2anki


Namemd2anki JSON
Version 3.0.20b0 PyPI version JSON
download
home_pagehttps://github.com/AnonymerNiklasistanonym/Md2Anki
SummaryConvert Markdown formatted documents to anki decks
upload_time2023-10-29 03:41:40
maintainer
docs_urlNone
authorAnonymerNiklasistanonym
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [//]: <> (BEGIN: HEADER)

# md2anki

Convert Markdown formatted documents to anki decks

[//]: <> (END: HEADER)

[![PyPI version](https://badge.fury.io/py/md2anki.svg)](https://badge.fury.io/py/md2anki)

The decks were tested on:

- [Anki (Desktop client, 2.1.56)](https://apps.ankiweb.net/)
- [Anki web (Browser client, 02.2022)](https://ankiweb.net/)
- [AnkiDroid (Android client, 2.15.6)](https://play.google.com/store/apps/details?id=com.ichi2.anki)

## Features

- Create an anki deck `.apkg` file
- The name of the deck and its notes will be updated on your next deck import (this works via automatic IDs, **deletions can not be tracked!**)
- Very simple basic structure that supports additionally anki note tags and anki subdecks:

- Supported question/answer content:
  - LaTeX math (inline and blocks)
  - Images (local files and URLs, vector and raster format)
  - Code (inline and blocks)
  - All basic Markdown features (i.e. tables, bold, italics, lines)
- Merge notes from multiple markdown input files into a single deck output file
- Export document and all used local assets to a custom directory that can easily be shared or used as backup

To evaluate code and export to pdf the following additional software needs to be installed:

```sh
# Linux
# > Ubuntu
# >> Evaluate code
sudo apt install clang inkscape latexmk nodejs texlive texlive-latex-extra #texlive-full
# >> PDF export
sudo apt install librsvg2-bin pandoc texlive-xetex
# > Arch/Manjaro
# Manjaro/Arch Linux
# >> Evaluate code
sudo pacman -S swi-prolog clang npm inkscape
# >> PDF export
sudo pacman -S pandoc-cli texlive-latex texlive-binextra texlive-xetex texlive-latexextra texlive-fontsextra texlive-luatex texlive-fontsrecommended
```

```ps1
# Windows (the choco package manager is just an example)
# > Evaluate code
choco install inkscape llvm miktex nodejs
# > PDF export
choco install miktex pandoc rsvg-convert
```

(On Windows `rsvg-convert` can sometimes throw errors in combination with `pandoc` but the latest build from [miyako](https://github.com/miyako/console-rsvg-convert/releases) does not throw them so try this one if you get errors)

```sh
# Linux + Windows
npm install -g ts-node
# > For matplotlib python graphs (used in some examples):
python -m pip install numpy matplotlib
```

### Examples

[//]: <> (BEGIN: EXAMPLES)

```markdown
# Example 'Basic' (3714486828)

## One line question (66b3661f-e22e-4986-a50d-569fdac454ad)

One line answer

## Multi line (24501c1a-f615-4355-a862-a00f64cc4725)

question thanks to a question answer separator (`---`)

---

Answer that has multiple lines.

**Basic** *Markdown* and <ins>HTML</ins> <del>formatting</del> is supported.

List:

- a
- b
  - c
  - d
    - e

New list:

1. abc
2. def
   - a
     1. maximum depth

## Question with multiple (parenthesis) (is) (possible) (b7b85393-b76d-43e6-965a-d86108bf5b09)

Answer

## Lines in answers with multiple `---` (f0e03cb6-2015-4f64-bcd3-51e24763705b)

First question answer seperator in the question.

---

Answer

---

Second part of answer with a line before it.
```

```markdown
# Example 'Subdeck' (750441971)

Example document to show how subdecks work.

`{=:global_tag:=}`

## Question 1 (f51d6aa5-1e39-4ad7-94fb-042f7084eff5)

Answer

## Subdeck: Subdeck Heading 1 (406542328)

All notes of the level 3 will be added to this subdeck.

`{=:subdeck_tag_1:=}`

### Question 1.1 (583813da-5766-4cb8-b39f-ae0337e1f13c)

Answer

## Question 1.2 (f51d6aa5-1e39-4ad8-94fb-047f7094eff5)

Answer

## Subdeck: Subdeck Heading 2 (406541128)

`{=:subdeck_tag_2:=}`

### Question 2.1 (583813da-5766-4cb8-b39f-ae0337e1f13c)

Answer

### Subdeck: Subdeck Heading 3 with escaped :​: double colon (406641128)

All notes of the level 4 will be added to this subdeck.

`{=:subdeck_subdeck_tag:=}`

#### Question 3.1 (583813da-5786-4cb8-b39f-ae0337e1f13c)

Answer

### Question 2.2 (583223da-5786-4cb8-b39f-ae0337e1f13c)

Answer
```

[//]: <> (END: EXAMPLES)

Checkout the [`examples`](https://github.com/AnonymerNiklasistanonym/Md2Anki/examples) directory for more examples.

If you want to run them all use the following command in that directory:

```sh
python -m examples
```

## Usage

[//]: <> (BEGIN: USAGE)

```text
usage: md2anki [-h] [-v] [--lexers] [-d [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]] [-e]
               [--evaluate-code-ignore-cache] [--evaluate-code-delete-cache] [-k]
               [-anki-model MODEL_ID] [-o-anki APKG_FILE] [-o-md MD_FILE] [-o-md-dir MD_DIR]
               [-o-backup-dir BACKUP_DIR] [-o-pdf PDF_FILE] [-evaluate-code-cache-dir CACHE_DIR]
               [-log-file LOG_FILE] [-file-dir [FILE_DIR ...]] [-md-heading-depth HEADING_DEPTH]
               [-custom-program language program] [-custom-program-args language program-args]
               MD_INPUT_FILE [MD_INPUT_FILE ...]

Create an anki deck file (.apkg) from one or more Markdown documents. If no custom output path is
given the file name of the document (+ .apkg) is used.

positional arguments:
  MD_INPUT_FILE         Markdown (.md) input file that contains anki deck notes

options:
  --evaluate-code-delete-cache
                        delete all cached files from previous code evaluations (default: False)
  --evaluate-code-ignore-cache
                        ignore the cached files from previous code evaluations (default: False)
  --lexers              print a list of all supported lexer languages and their aliases
  -anki-model MODEL_ID  custom anki card model (md2anki_type_default, md2anki_type_answer,
                        md2anki_type_cloze, md2anki_type_cloze_extra) (default:
                        md2anki_type_default)
  -custom-program language program
                        use custom program for code evaluation [i.e. "py" "python3.11"] (default:
                        [('py', 'python'), ('js', 'node'), ('ts', 'ts-node'), ('pl', 'swipl'),
                        ('latex', 'latexmk'), ('latex', 'inkscape'), ('cpp', 'clang++'), ('cpp',
                        'main.exe'), ('c', 'clang'), ('c', 'main.exe'), ('pandoc_pdf', 'pandoc')])
  -custom-program-args language program-args
                        use custom program args for code evaluation [i.e. "py"
                        "[\"-c\",\"MD2ANKI_CODE\"]"] (default: [('py', '["-c", "MD2ANKI_CODE"]'),
                        ('js', '["-e", "MD2ANKI_CODE"]'), ('ts', '["MD2ANKI_CODE_FILE=code.ts"]'),
                        ('pl', '["-O", "-s", "MD2ANKI_CODE_FILE=code.pl", "-g", "true", "-t",
                        "halt."]'), ('latex', '["-shell-escape", "-pdf",
                        "MD2ANKI_CODE_FILE=code.tex"]'), ('latex', '["--export-filename=code.svg",
                        "code.pdf"]'), ('cpp', '["-Wall", "-std=c++20",
                        "MD2ANKI_CODE_FILE=main.cpp", "-o", "main.exe"]'), ('cpp', '[]'), ('c',
                        '["-std=c17", "MD2ANKI_CODE_FILE=main.c", "-o", "main.exe"]'), ('c',
                        '[]'), ('pandoc_pdf', '["--from", "markdown", "--to", "pdf", "--table-of-
                        contents", "-V", "geometry:a4paper", "-V", "geometry:margin=2cm", "--pdf-
                        engine=xelatex", "--pdf-engine-opt=-shell-escape"]')])
  -d [{DEBUG,INFO,WARNING,ERROR,CRITICAL}], --debug [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                        custom log level to the console (default: INFO)
  -e, --evaluate-code   evaluate markdown inline code/code blocks with the language prefix '='
                        i.e. '`print(1+1)`{=python}' or '```{=python} [newline] print(1+1)
                        [newline] ```' (default: False)
  -evaluate-code-cache-dir CACHE_DIR
                        use a custom cache dir for code evaluations (default: None)
  -file-dir [FILE_DIR ...]
                        add directories that should be checked for referenced files (like relative
                        path images) (default: [])
  -h, --help            show this help message and exit
  -k, --keep-temp-files
                        keep temporary files (default: False)
  -log-file LOG_FILE    log all messages to a text file (.log) (default: None)
  -md-heading-depth HEADING_DEPTH
                        use a custom Markdown heading depth (>=1) (default: 1)
  -o-anki APKG_FILE     custom anki deck (.apkg) output file path [if not given: md input file
                        name + .apkg] (default: None)
  -o-backup-dir BACKUP_DIR
                        create a backup of the anki deck (i.e. merges input files and copies
                        external files) in a directory (default: None)
  -o-md MD_FILE         custom updated (and merged if multiple input files) Markdown (.md) output
                        file path for all input files (default: None)
  -o-md-dir MD_DIR      custom output directory for all updated Markdown (.md) input files
                        (default: None)
  -o-pdf PDF_FILE       create a PDF (.pdf) file of the anki deck (i.e. merges input files and
                        removes IDs) (default: None)
  -v, --version         show program's version number and exit
```

[//]: <> (END: USAGE)

### Linux (bash)

```sh
# Single source file
md2anki anki_deck.md -o-anki anki_deck.apkg
# Multiple source files
md2anki *.md -o-anki anki_deck.apkg
```

### Windows (powershell)

```pwsh
# Single source file
md2anki anki_deck.md -o-anki anki_deck.apkg
# Multiple source files
md2anki (Get-ChildItem -Filter *.md) -o-anki anki_deck.apkg
```

## Install

### PyPI

It can be installed using [`pip`](https://pypi.org/project/md2anki/):

```sh
# Install
pip install md2anki
# Uninstall
pip uninstall md2anki
```

### GitHub Releases

1. Download a wheel (`.whl`) file from [GitHub Releases](https://github.com/AnonymerNiklasistanonym/Md2Anki/releases)
2. Run:

   ```sh
   # Install
   pip install md2anki-$CURRENT_VERSION-py3-none-any.whl
   # Uninstall
   pip uninstall md2anki
   ```

### Pacman

```sh
cd pkgbuild
# Build package and then install it via pacman
makepkg -p PKGBUILD --syncdeps --rmdeps --clean
pacman -S python-md2anki-3.0.19b-1-any.pkg.tar.zst
# Or build and install package
makepkg -p PKGBUILD --syncdeps --rmdeps --clean --install
# Remove package
pacman -R python-md2anki
```

### Build

Via the file [`setup.py`](https://github.com/AnonymerNiklasistanonym/Md2Anki/setup.py) the package can be built:

#### Create package files

The following commands create the package files in a new directory called `dist`:

- `md2anki-$CURRENT_VERSION-py3-none-any.whl`
- `md2anki-$CURRENT_VERSION.tar.gz`

```sh
python -m pip install --upgrade build
python -m build
```

#### Install package files

The wheel (`.whl`) file can be installed and uninstalled via `pip`:

```sh
# Install
python -m pip install dist/md2anki-$CURRENT_VERSION-py3-none-any.whl
# Uninstall
python -m pip uninstall md2anki
```

## Markdown Editors

A list of editors which support WYSIWYG editing of such Markdown documents (source code and math blocks):

- [Typora](https://typora.io/) (paid, free to use until version 0.9)
- [Visual Studio Code](https://code.visualstudio.com/) (open source)

## Development

### Dependencies

- [`beautifulsoup4`](https://pypi.org/project/beautifulsoup4/): Edit HTML
- [`genanki`](https://pypi.org/project/genanki/): Write Anki decks
- [`Markdown`](https://pypi.org/project/Markdown/): Convert Markdown to HTML
- [`Pygments`](https://pypi.org/project/Pygments/): Convert source code to HTML with syntax highlighting/colors

```sh
python -m pip install --upgrade pip
# Runtime dependencies
python -m pip install --upgrade beautifulsoup4 genanki Markdown Pygments
# Save requirements
python -m pip freeze > "requirements.txt"
```

### Upload package to PyPI

1. [Create an PyPI account](https://pypi.org/account/login/)
2. Go to account settings, Scroll to API tokens, Create PyPI API token (with only the project scope if project already exists)

```sh
# Build
python -m pip install --upgrade pip build
python -m build
# Upload (only if a non existing version is found)
python -m pip install twine
python -m twine upload --skip-existing dist/*
# Use as username: "__token__"
# Use as password the created PyPI API token: "pypi-......"
```

### Type checks

Python files can be checked for type errors (to some extent) using the commands:

```sh
python -m pip install --upgrade mypy types-beautifulsoup4 types-Markdown types-Pygments
python -m mypy src setup.py examples tests clean.py main.py update_readme.py update_pkgbuild.py format.py
```

### Tests

The tests can be run using the command (in the `tests` directory):

```sh
python -m unittest
```

### Format code

Python files can be formatted using the commands:

```sh
python -m pip install --upgrade black
# Add the option --check to only check if its already in the correct format
python -m black src setup.py examples tests clean.py main.py update_readme.py
```

### Code editors

This project was written using the following code editors (IDEs):

- [PyCharm (Community)](https://www.jetbrains.com/pycharm/download/)
- [Visual Studio Code](https://code.visualstudio.com/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AnonymerNiklasistanonym/Md2Anki",
    "name": "md2anki",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "AnonymerNiklasistanonym",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b1/be/54a5fb16f3c2d83ccd192f97fb4176e34467f05d63d22eb2b0da46c621d4/md2anki-3.0.20b0.tar.gz",
    "platform": null,
    "description": "[//]: <> (BEGIN: HEADER)\n\n# md2anki\n\nConvert Markdown formatted documents to anki decks\n\n[//]: <> (END: HEADER)\n\n[![PyPI version](https://badge.fury.io/py/md2anki.svg)](https://badge.fury.io/py/md2anki)\n\nThe decks were tested on:\n\n- [Anki (Desktop client, 2.1.56)](https://apps.ankiweb.net/)\n- [Anki web (Browser client, 02.2022)](https://ankiweb.net/)\n- [AnkiDroid (Android client, 2.15.6)](https://play.google.com/store/apps/details?id=com.ichi2.anki)\n\n## Features\n\n- Create an anki deck `.apkg` file\n- The name of the deck and its notes will be updated on your next deck import (this works via automatic IDs, **deletions can not be tracked!**)\n- Very simple basic structure that supports additionally anki note tags and anki subdecks:\n\n- Supported question/answer content:\n  - LaTeX math (inline and blocks)\n  - Images (local files and URLs, vector and raster format)\n  - Code (inline and blocks)\n  - All basic Markdown features (i.e. tables, bold, italics, lines)\n- Merge notes from multiple markdown input files into a single deck output file\n- Export document and all used local assets to a custom directory that can easily be shared or used as backup\n\nTo evaluate code and export to pdf the following additional software needs to be installed:\n\n```sh\n# Linux\n# > Ubuntu\n# >> Evaluate code\nsudo apt install clang inkscape latexmk nodejs texlive texlive-latex-extra #texlive-full\n# >> PDF export\nsudo apt install librsvg2-bin pandoc texlive-xetex\n# > Arch/Manjaro\n# Manjaro/Arch Linux\n# >> Evaluate code\nsudo pacman -S swi-prolog clang npm inkscape\n# >> PDF export\nsudo pacman -S pandoc-cli texlive-latex texlive-binextra texlive-xetex texlive-latexextra texlive-fontsextra texlive-luatex texlive-fontsrecommended\n```\n\n```ps1\n# Windows (the choco package manager is just an example)\n# > Evaluate code\nchoco install inkscape llvm miktex nodejs\n# > PDF export\nchoco install miktex pandoc rsvg-convert\n```\n\n(On Windows `rsvg-convert` can sometimes throw errors in combination with `pandoc` but the latest build from [miyako](https://github.com/miyako/console-rsvg-convert/releases) does not throw them so try this one if you get errors)\n\n```sh\n# Linux + Windows\nnpm install -g ts-node\n# > For matplotlib python graphs (used in some examples):\npython -m pip install numpy matplotlib\n```\n\n### Examples\n\n[//]: <> (BEGIN: EXAMPLES)\n\n```markdown\n# Example 'Basic' (3714486828)\n\n## One line question (66b3661f-e22e-4986-a50d-569fdac454ad)\n\nOne line answer\n\n## Multi line (24501c1a-f615-4355-a862-a00f64cc4725)\n\nquestion thanks to a question answer separator (`---`)\n\n---\n\nAnswer that has multiple lines.\n\n**Basic** *Markdown* and <ins>HTML</ins> <del>formatting</del> is supported.\n\nList:\n\n- a\n- b\n  - c\n  - d\n    - e\n\nNew list:\n\n1. abc\n2. def\n   - a\n     1. maximum depth\n\n## Question with multiple (parenthesis) (is) (possible) (b7b85393-b76d-43e6-965a-d86108bf5b09)\n\nAnswer\n\n## Lines in answers with multiple `---` (f0e03cb6-2015-4f64-bcd3-51e24763705b)\n\nFirst question answer seperator in the question.\n\n---\n\nAnswer\n\n---\n\nSecond part of answer with a line before it.\n```\n\n```markdown\n# Example 'Subdeck' (750441971)\n\nExample document to show how subdecks work.\n\n`{=:global_tag:=}`\n\n## Question 1 (f51d6aa5-1e39-4ad7-94fb-042f7084eff5)\n\nAnswer\n\n## Subdeck: Subdeck Heading 1 (406542328)\n\nAll notes of the level 3 will be added to this subdeck.\n\n`{=:subdeck_tag_1:=}`\n\n### Question 1.1 (583813da-5766-4cb8-b39f-ae0337e1f13c)\n\nAnswer\n\n## Question 1.2 (f51d6aa5-1e39-4ad8-94fb-047f7094eff5)\n\nAnswer\n\n## Subdeck: Subdeck Heading 2 (406541128)\n\n`{=:subdeck_tag_2:=}`\n\n### Question 2.1 (583813da-5766-4cb8-b39f-ae0337e1f13c)\n\nAnswer\n\n### Subdeck: Subdeck Heading 3 with escaped :\u200b: double colon (406641128)\n\nAll notes of the level 4 will be added to this subdeck.\n\n`{=:subdeck_subdeck_tag:=}`\n\n#### Question 3.1 (583813da-5786-4cb8-b39f-ae0337e1f13c)\n\nAnswer\n\n### Question 2.2 (583223da-5786-4cb8-b39f-ae0337e1f13c)\n\nAnswer\n```\n\n[//]: <> (END: EXAMPLES)\n\nCheckout the [`examples`](https://github.com/AnonymerNiklasistanonym/Md2Anki/examples) directory for more examples.\n\nIf you want to run them all use the following command in that directory:\n\n```sh\npython -m examples\n```\n\n## Usage\n\n[//]: <> (BEGIN: USAGE)\n\n```text\nusage: md2anki [-h] [-v] [--lexers] [-d [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]] [-e]\n               [--evaluate-code-ignore-cache] [--evaluate-code-delete-cache] [-k]\n               [-anki-model MODEL_ID] [-o-anki APKG_FILE] [-o-md MD_FILE] [-o-md-dir MD_DIR]\n               [-o-backup-dir BACKUP_DIR] [-o-pdf PDF_FILE] [-evaluate-code-cache-dir CACHE_DIR]\n               [-log-file LOG_FILE] [-file-dir [FILE_DIR ...]] [-md-heading-depth HEADING_DEPTH]\n               [-custom-program language program] [-custom-program-args language program-args]\n               MD_INPUT_FILE [MD_INPUT_FILE ...]\n\nCreate an anki deck file (.apkg) from one or more Markdown documents. If no custom output path is\ngiven the file name of the document (+ .apkg) is used.\n\npositional arguments:\n  MD_INPUT_FILE         Markdown (.md) input file that contains anki deck notes\n\noptions:\n  --evaluate-code-delete-cache\n                        delete all cached files from previous code evaluations (default: False)\n  --evaluate-code-ignore-cache\n                        ignore the cached files from previous code evaluations (default: False)\n  --lexers              print a list of all supported lexer languages and their aliases\n  -anki-model MODEL_ID  custom anki card model (md2anki_type_default, md2anki_type_answer,\n                        md2anki_type_cloze, md2anki_type_cloze_extra) (default:\n                        md2anki_type_default)\n  -custom-program language program\n                        use custom program for code evaluation [i.e. \"py\" \"python3.11\"] (default:\n                        [('py', 'python'), ('js', 'node'), ('ts', 'ts-node'), ('pl', 'swipl'),\n                        ('latex', 'latexmk'), ('latex', 'inkscape'), ('cpp', 'clang++'), ('cpp',\n                        'main.exe'), ('c', 'clang'), ('c', 'main.exe'), ('pandoc_pdf', 'pandoc')])\n  -custom-program-args language program-args\n                        use custom program args for code evaluation [i.e. \"py\"\n                        \"[\\\"-c\\\",\\\"MD2ANKI_CODE\\\"]\"] (default: [('py', '[\"-c\", \"MD2ANKI_CODE\"]'),\n                        ('js', '[\"-e\", \"MD2ANKI_CODE\"]'), ('ts', '[\"MD2ANKI_CODE_FILE=code.ts\"]'),\n                        ('pl', '[\"-O\", \"-s\", \"MD2ANKI_CODE_FILE=code.pl\", \"-g\", \"true\", \"-t\",\n                        \"halt.\"]'), ('latex', '[\"-shell-escape\", \"-pdf\",\n                        \"MD2ANKI_CODE_FILE=code.tex\"]'), ('latex', '[\"--export-filename=code.svg\",\n                        \"code.pdf\"]'), ('cpp', '[\"-Wall\", \"-std=c++20\",\n                        \"MD2ANKI_CODE_FILE=main.cpp\", \"-o\", \"main.exe\"]'), ('cpp', '[]'), ('c',\n                        '[\"-std=c17\", \"MD2ANKI_CODE_FILE=main.c\", \"-o\", \"main.exe\"]'), ('c',\n                        '[]'), ('pandoc_pdf', '[\"--from\", \"markdown\", \"--to\", \"pdf\", \"--table-of-\n                        contents\", \"-V\", \"geometry:a4paper\", \"-V\", \"geometry:margin=2cm\", \"--pdf-\n                        engine=xelatex\", \"--pdf-engine-opt=-shell-escape\"]')])\n  -d [{DEBUG,INFO,WARNING,ERROR,CRITICAL}], --debug [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]\n                        custom log level to the console (default: INFO)\n  -e, --evaluate-code   evaluate markdown inline code/code blocks with the language prefix '='\n                        i.e. '`print(1+1)`{=python}' or '```{=python} [newline] print(1+1)\n                        [newline] ```' (default: False)\n  -evaluate-code-cache-dir CACHE_DIR\n                        use a custom cache dir for code evaluations (default: None)\n  -file-dir [FILE_DIR ...]\n                        add directories that should be checked for referenced files (like relative\n                        path images) (default: [])\n  -h, --help            show this help message and exit\n  -k, --keep-temp-files\n                        keep temporary files (default: False)\n  -log-file LOG_FILE    log all messages to a text file (.log) (default: None)\n  -md-heading-depth HEADING_DEPTH\n                        use a custom Markdown heading depth (>=1) (default: 1)\n  -o-anki APKG_FILE     custom anki deck (.apkg) output file path [if not given: md input file\n                        name + .apkg] (default: None)\n  -o-backup-dir BACKUP_DIR\n                        create a backup of the anki deck (i.e. merges input files and copies\n                        external files) in a directory (default: None)\n  -o-md MD_FILE         custom updated (and merged if multiple input files) Markdown (.md) output\n                        file path for all input files (default: None)\n  -o-md-dir MD_DIR      custom output directory for all updated Markdown (.md) input files\n                        (default: None)\n  -o-pdf PDF_FILE       create a PDF (.pdf) file of the anki deck (i.e. merges input files and\n                        removes IDs) (default: None)\n  -v, --version         show program's version number and exit\n```\n\n[//]: <> (END: USAGE)\n\n### Linux (bash)\n\n```sh\n# Single source file\nmd2anki anki_deck.md -o-anki anki_deck.apkg\n# Multiple source files\nmd2anki *.md -o-anki anki_deck.apkg\n```\n\n### Windows (powershell)\n\n```pwsh\n# Single source file\nmd2anki anki_deck.md -o-anki anki_deck.apkg\n# Multiple source files\nmd2anki (Get-ChildItem -Filter *.md) -o-anki anki_deck.apkg\n```\n\n## Install\n\n### PyPI\n\nIt can be installed using [`pip`](https://pypi.org/project/md2anki/):\n\n```sh\n# Install\npip install md2anki\n# Uninstall\npip uninstall md2anki\n```\n\n### GitHub Releases\n\n1. Download a wheel (`.whl`) file from [GitHub Releases](https://github.com/AnonymerNiklasistanonym/Md2Anki/releases)\n2. Run:\n\n   ```sh\n   # Install\n   pip install md2anki-$CURRENT_VERSION-py3-none-any.whl\n   # Uninstall\n   pip uninstall md2anki\n   ```\n\n### Pacman\n\n```sh\ncd pkgbuild\n# Build package and then install it via pacman\nmakepkg -p PKGBUILD --syncdeps --rmdeps --clean\npacman -S python-md2anki-3.0.19b-1-any.pkg.tar.zst\n# Or build and install package\nmakepkg -p PKGBUILD --syncdeps --rmdeps --clean --install\n# Remove package\npacman -R python-md2anki\n```\n\n### Build\n\nVia the file [`setup.py`](https://github.com/AnonymerNiklasistanonym/Md2Anki/setup.py) the package can be built:\n\n#### Create package files\n\nThe following commands create the package files in a new directory called `dist`:\n\n- `md2anki-$CURRENT_VERSION-py3-none-any.whl`\n- `md2anki-$CURRENT_VERSION.tar.gz`\n\n```sh\npython -m pip install --upgrade build\npython -m build\n```\n\n#### Install package files\n\nThe wheel (`.whl`) file can be installed and uninstalled via `pip`:\n\n```sh\n# Install\npython -m pip install dist/md2anki-$CURRENT_VERSION-py3-none-any.whl\n# Uninstall\npython -m pip uninstall md2anki\n```\n\n## Markdown Editors\n\nA list of editors which support WYSIWYG editing of such Markdown documents (source code and math blocks):\n\n- [Typora](https://typora.io/) (paid, free to use until version 0.9)\n- [Visual Studio Code](https://code.visualstudio.com/) (open source)\n\n## Development\n\n### Dependencies\n\n- [`beautifulsoup4`](https://pypi.org/project/beautifulsoup4/): Edit HTML\n- [`genanki`](https://pypi.org/project/genanki/): Write Anki decks\n- [`Markdown`](https://pypi.org/project/Markdown/): Convert Markdown to HTML\n- [`Pygments`](https://pypi.org/project/Pygments/): Convert source code to HTML with syntax highlighting/colors\n\n```sh\npython -m pip install --upgrade pip\n# Runtime dependencies\npython -m pip install --upgrade beautifulsoup4 genanki Markdown Pygments\n# Save requirements\npython -m pip freeze > \"requirements.txt\"\n```\n\n### Upload package to PyPI\n\n1. [Create an PyPI account](https://pypi.org/account/login/)\n2. Go to account settings, Scroll to API tokens, Create PyPI API token (with only the project scope if project already exists)\n\n```sh\n# Build\npython -m pip install --upgrade pip build\npython -m build\n# Upload (only if a non existing version is found)\npython -m pip install twine\npython -m twine upload --skip-existing dist/*\n# Use as username: \"__token__\"\n# Use as password the created PyPI API token: \"pypi-......\"\n```\n\n### Type checks\n\nPython files can be checked for type errors (to some extent) using the commands:\n\n```sh\npython -m pip install --upgrade mypy types-beautifulsoup4 types-Markdown types-Pygments\npython -m mypy src setup.py examples tests clean.py main.py update_readme.py update_pkgbuild.py format.py\n```\n\n### Tests\n\nThe tests can be run using the command (in the `tests` directory):\n\n```sh\npython -m unittest\n```\n\n### Format code\n\nPython files can be formatted using the commands:\n\n```sh\npython -m pip install --upgrade black\n# Add the option --check to only check if its already in the correct format\npython -m black src setup.py examples tests clean.py main.py update_readme.py\n```\n\n### Code editors\n\nThis project was written using the following code editors (IDEs):\n\n- [PyCharm (Community)](https://www.jetbrains.com/pycharm/download/)\n- [Visual Studio Code](https://code.visualstudio.com/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert Markdown formatted documents to anki decks",
    "version": "3.0.20b0",
    "project_urls": {
        "Bug Tracker": "https://github.com/AnonymerNiklasistanonym/Md2Anki/issues",
        "Homepage": "https://github.com/AnonymerNiklasistanonym/Md2Anki"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "add775a2746646a5653504f26890077b78b3fb2383160114dce8f6394e5d7078",
                "md5": "ff2e6b071d694dd665a946421570d3a7",
                "sha256": "8bbdcce29e1fd07bc5f4f17fe4d332b24d51d182547d7cd57ed858490cfea17a"
            },
            "downloads": -1,
            "filename": "md2anki-3.0.20b0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff2e6b071d694dd665a946421570d3a7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 41443,
            "upload_time": "2023-10-29T03:41:38",
            "upload_time_iso_8601": "2023-10-29T03:41:38.811178Z",
            "url": "https://files.pythonhosted.org/packages/ad/d7/75a2746646a5653504f26890077b78b3fb2383160114dce8f6394e5d7078/md2anki-3.0.20b0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1be54a5fb16f3c2d83ccd192f97fb4176e34467f05d63d22eb2b0da46c621d4",
                "md5": "a56080d6bbad94a980662f7a9e32a5a2",
                "sha256": "90094bc7db5146af12f59fbd2386c3bf06b398adb5217550497615f77bf875be"
            },
            "downloads": -1,
            "filename": "md2anki-3.0.20b0.tar.gz",
            "has_sig": false,
            "md5_digest": "a56080d6bbad94a980662f7a9e32a5a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 44862,
            "upload_time": "2023-10-29T03:41:40",
            "upload_time_iso_8601": "2023-10-29T03:41:40.577723Z",
            "url": "https://files.pythonhosted.org/packages/b1/be/54a5fb16f3c2d83ccd192f97fb4176e34467f05d63d22eb2b0da46c621d4/md2anki-3.0.20b0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-29 03:41:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AnonymerNiklasistanonym",
    "github_project": "Md2Anki",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "md2anki"
}
        
Elapsed time: 0.13304s