Leon0402 / asciidoctor-flashcard

Create flashcards for anki from an AsciiDoctor file
MIT License
1 stars 1 forks source link

Provide usage examples? #1

Open brunchboy opened 2 years ago

brunchboy commented 2 years ago

We were trying to help someone in the Asciidoctor community who wanted to embed flash cards in their AsciiDoc documents, then convert them for input to anki, and saw that this project looked like it might be perfect. But we don’t know how to use it! Could you add some usage examples to the README showing the AsciiDoc format that is expected for the flashcards, and how to run Asciidoctor with your extension to produce the anki input?

Leon0402 commented 2 years ago

You can have a look at the test folder. It's not too diffiuclt, for instance:

[flashcard, 10]
====
[.question]
What is the speed of light?

[.answer]
300,000 km/sec

[.tags]
tag1, tag2
====

Use flashcard block, give it an id and then define question and answer. if the question has no new line, simpler syntax can be used:

[flashcard, 30]
====
What is the answer to everything?

42.
====

You would then use the converter as here: https://github.com/Leon0402/asciidoctor-flashcard/blob/master/tests/test_with_anki.rb

This will output everything as csv which can then be imported in anki. Important thing is to create a custom note type in anki, which matches the structure.

I basically had an asciidoctor note type with an id, question and answer field. Additionally I copied the asciidoctor css over there.

The implementation has some major limitations though, which are mostly limitations by the anki csv import feature. I therefore started working on a more sophisticated converter based on the yaml format and write my own anki import plugin for this.

Some of the issues can be read here: https://forums.ankiweb.net/t/import-problems-suggestions/5856

I lost a little bit track of the work, because the api of anki wasn't documented at all and it seemed like the anki author was doing major changes to the import system and the api at that time.