Convert markdown file to Anki cards.
Use AnkiConnect to import Markdown file into anki cards with Basic module(have only 2 sides).
Mistune is used to parse markdown file to html.
So syntax like *..*
, **..**
,`..`(code block), etc are supported.
For more information: https://github.com/lepture/mistune
Extra functions:
-
Support math blocks:
$..$ and$$...$$ -
Import media to Anki media folder
-
Keep structures of markdown folder in decks and subdecks in Anki
(e.g.
./math/algebra.md
will be imported tomath::algebra
) -
Front of cards will be added the deck name to avoid duplicate
Note that a known bug is that if you use two syntax to show img in one md file mistune probably will not parse the syntax correctly.
For example:
<img src="...">\n![...](...)
will be parsed in wrong syntax.To update a card you need to clear the back of the card or delete the card in Anki first.
- Install AnkiConnect plugin in Anki (tutorial: https://foosoft.net/projects/anki-connect/)
- run
pip install -r requir$ements.txt
to install dependencies - run
python main.py path-to-your-md-folder
to start the program with Anki running
Default separators work as the following example. You can change them in main.py.
Markdown:
7.1.2 The Permutation Representation
% <--- default separator for front and back (including blank lines before and after)
$$
\begin{aligned}
&G\to\text{Perm}(G)\\
&g\leadsto m_g\text{ - left multiplication by }g
\end{aligned}
$$
defined by this operation is injective.
---- <--- default separator for cards (including blank lines before and after)
7.1.3 **Cayley's Theorem**.
%
Every finite group is isomorphic to a subgroup of a permutation group. A group of order $n$ is isomorphic to a subgroup of $S_n$.
Anki: