2012년 10월 17일 수요일

Formatting Mnemosyne Flash Cards - Indenting Code Snippets

To help me memorize Python syntax and built-in functions for 6.00x Introduction to Computer Science and Programming, I've created some flashcards using Mnemosyne, the open-source flashcard program that uses an adaptive learning algorithm to determine how often to quiz you on certain cards (mnemosyne is available in the Debian repo's).

One problem is that regular text in flashcards cannot be indented. I've made several cards that contain snippets of Python code, but all the code indentation disappears after saving (which is problematic since Python determines nesting through indentation rather than with brackets). Fortunately, Mnemosyne supports HTML tags which can be used for formatting. Although HTML doesn't directly display tabs, enclosing the entire code fragment in the tags <pre></pre> will allow you to use indentation.