diff --git a/README.md b/README.md index 3b1f85d..af2248b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,9 @@ Find the definition of the current word using Ellama. Summarize a selected region or the current buffer using Ellama. ![ellama-summarize](imgs/ellama-summarize.gif) +### ellama-make-flash-cards +Create flashcards in org-mode headline format, which could later be used with packages such as [org-anki](https://github.com/eyeinsky/org-anki). + ### ellama-code-review Review code in a selected region or the current buffer using Ellama. diff --git a/ellama.el b/ellama.el index 0b0d292..c1e9454 100644 --- a/ellama.el +++ b/ellama.el @@ -244,6 +244,26 @@ In BUFFER at POINT will be inserted result between PREFIX and SUFFIX." (buffer-substring-no-properties (point-min) (point-max))))) (ellama-instant (format "Text:\n%s\nSummarize it." text)))) +;;;###autoload +(defun ellama-make-flash-cards () + "Create flash cards from active region or current buffer." + (interactive) + (let ((text (if (region-active-p) + (buffer-substring-no-properties (region-beginning) (region-end)) + (buffer-substring-no-properties (point-min) (point-max))))) + (ellama-chat (concat (format "Text:\n%s\n" text) + "Instructions:\n" + "Create anki flash cards for the above text. Break the text down into different flashcards.\n" + "Each flashcard should be clear, precise and consistent. Try extracting info about attributes/tendencies, similarities/differences,causes/effects, significance/implications etc and mention them in the flashcards wherever relevant." + "If there is a link in markdown format, you can skip it.\n\n" + "Format for flashcards (2 lines):\n" + "- First line: Front of the card (question), put an asterisk symbol and a space character infront as a prefix.\n" + "- Second line: Back of the card (answer), keep the answer short and precise\n\n" + "Example:\n" + "* What is an apple?\n" + "A fruit" + )))) + ;;;###autoload (defun ellama-code-review () "Review code in selected region or current buffer."