Awesome
org_to_anki
Python module to convert org or txt files into Anki question decks. Also offered as an Add-on for Anki Lists to Anki
Provides a command line script to upload an org or txt file to Anki.
Based on AnkiConnect. An addon for Anki that provides a HTTP api for Anki.
Contents
- Supported file types
- What is an org file
- Using Org or text files
- Using LibreOffice files
- Installation
- Comand line scripts
- Running tests
- Contributing
Supported file types
This project supports reading from both .org, .txt and odt (LibreOffice) files.
To use LibreOffice files these must first be saved as HTML files. Please read the documentation on this.
Microsoft Word (.docx) files are no longer supported. Migration path is below
Word files to LibreOffice migraiton path
Users with existing Word files can migarte them to Libre office by doing the following:
- Install LibreOffice (Free / OpenSource Word equvilant)
- Open the file in LibreOffice
- Save file as ODT format
What is an org file?
An org files a basic text file, very similar to .txt files. The file type is from Org Mode for Emacs but really you don't need to know much about this.
This is all you need to know for this project.
-
Asterisks ( * ) are used to to create bullet point style lists.
-
.org files are series of lists
-
A list item for a question starts with *
-
A list item for a answer starts with **
-
A comment starts with a #
Examples are provided below.
Here is some example syntax for how question should be laid out
* Question
** Answer 1
** Answer 2
* Another Question
** Another answer
More information on org-mode
Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system
Org and Text files
Documentation on Org and Text files
LibreOffice
Documentation on LibreOffice files
Installation
Requirements
-
Have the Anki app installed.
-
Installing the Anki plugin AnkiConnect.
i. For macOS users of anki-connect see note for macOS users
ii. For Windows users of anki-connect see notes for Windows users
To install this module from source on Linux or macOS:
git clone https://github.com/c-okelly/org_to_anki
cd org_to_ani
python3 setup.py install
If the org_to_anki
command returns a module not found
error try the using the following command:
pip3 install ./
instead of
python3 setup.py install
Command line scripts
org_to_anki
org_to_anki
- Upload the default org file to Anki
org_to_anki /path/to/your/org/file.org
- Upload the specified file to Anki
Config values
- Config in project root contains all the default values for running
- Default org file is located at ~/orgNotes/quickOrgNotes.org
- Default anki-connect url is http://127.0.0.1:8765/
Testing
A number of extra libraries are used in testing
- To run unittests
python3 setup.py nosetests
Contributing
All contributions are welcome. Please open a issue first to discuss your ideas!