xkevio / typst-anki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typst-anki

Convert typst math code to MathJax (via pandoc) or SVGs (via the typst compiler) for use in Anki flashcards. Click either the Typst button or press Ctrl + M, T. Add custom functions inside preamble.py!

Important

Use MathJax for consistency. The SVGs directly from Typst are very misaligned inside the text field.

Installation

git clone git@github.com:xkevio/typst-anki.git
cd typst-anki/src/typst_anki

mkdir lib # <- this stores external dependencies for Anki.
pip install typst -t ./lib/
pip install pypandoc -t ./lib/

zip -r typst_anki.zip __init__.py typst_input_dialog.py manifest.json ./lib/

Then, open Anki > Tools > Addons > Install from file > typst_anki.zip. (Pandoc needs to be installed on your system and available via $PATH.) Or, if you wish, use just.

TODO

  • Feature: Use Typst HTML export when it releases.
  • Inconsistency: Typst SVG option uses display math as otherwise small margins will cut parts off while MathJax always uses inline math for now.
  • Issue (?): It seems to prepend the output on some Linux systems, perhaps because the web engine behind QWebEngineView differs.

About

License:Creative Commons Zero v1.0 Universal


Languages

Language:Python 95.6%Language:Just 4.4%