Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add source code to flashcard in Anki

📅 2015-Jul-08 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ addon, anki, pygments ⬩ 📚 Archive

Syntax Highlighting for Code is an addon for Anki which enables you to add source code or pseudo-code to a flash card question or answer section. This is necessary for source code because Anki centers all text and that makes any source code text you add to a flash card impossible to understand!

This addon also automatically adds the appropriate syntax highlighting colors to the text. There is a huge variety of languages that it supports for this highlighting.

$ sudo apt install python-pygments
$ git clone https://github.com/tmbb/SyntaxHighlight.git

Tried with: Anki 2.0.33 and Ubuntu 14.04