org-anki
org-anki copied to clipboard
Support subheadings as content for Back of a card
Hi,
Thanks for this nice package!
I noticed that currently it doesn't support to include subheadings as content for Back. For example, Back content for test
only contains "aaa", without content of the sub
subheading:
** test
aaa
*** sub
bbb
Do you think it's a good idea to support this? Thanks.
Hi, yes, this would be a useful feature. I guess the method would be to add a special property for it which one could add to the heading, at the file level and then as a global customizable variable.
There would be a minor difficulty for the command that syncs all headings in a file -- it would need to start skipping the subheadings that are already added as part of their parent heading.
Hi Markus,
I'm not sure what a typical heading hierarchy looks like for =org-anki-sync-all=. For me, I'd like to put all node headings at the same level in a org-mode file, so I'm wondering maybe we could define a node level property so that org-anki-sync-all and org-anki-sync/delete-entry would know what headings are interested. (P.S. I have a command named org-anki-sync-subentries locally for this hierarchy.)
Or more flexibly, we could define a "node container" property or something like that, so that all those commands will only consider the subheadings inside them as nodes.
What do you think?
Hi, and thank you for the explanation, now I understand the issue! :)
How org-anki-sync-all
currently works is that iterates through all entries regardless of what their level is and makes cards from them (see below for example[1]). Both of the solutions you mention can theoretically work (1: have a fixed level, 2: have a entry property where all subheadings are taken as content, not as new cards). Just need to figure out what in the org-mode API can help us implement these.
Maybe you can also share your org-anki-sync-subentries
somewhere to see how it's implemented?
[1] All of these will become separate cards:
* Card 1 title
Card 1 content
** Card 2 title
Card 2 content
*** Card 3 title
Card 3 content
Hi,
For me, it's more likely to start a new first level heading dedicated for Anki cards in an existed org file, and then add second level headings as cards. So I need a syncing subentries command, it's like this:
(defun w/org-anki-sync-subentries ()
"Sync all subentries of the current entry at point.
Also respect `org-anki-skip-function'."
(interactive)
(save-excursion
(let* ((next-level (1+ (org-current-level))))
(org-map-entries (lambda ()
(when (and t
;; (member "foo" (org-get-tags)) ; ad-hoc tag filtering
(= next-level (org-element-property :level (org-element-at-point))))
(org-anki-sync-entry)))
nil
'tree
org-anki-skip-function))))
@whatacold I'm thinking of implementing this through a special command which does the following two things
- add a skip function to include entries at a fixed depth
- add a setting to enable syncing of sub-headings
Why have a special command: the second point above doesn't make sense when the first one isn't set (users would be shooting themselves in the foot by sync all subcontent for all org entries recursively).
@basaran Could you create a new issue for this, so we don't mix up the two :)
I know, I'm sorry. Just wanted to provide the details to the summary but it ended up going in a different direction. I will create the thread shortly.
This would be awesome and also provide instant compatibility with Logseq (:card: tag).
Notably pls let it also include content from under the subheadings too. Like this:
* FRONT CONTENT :card:
FRONT CONTENT
* * BACK CONTENT
BACK CONTENT
Honestly as a Logseq user, I really need this because the current SRS algorithm is faulty (FSRS will still take a while, if ever). I wish I could actually write elisp so that I could send a PR. (I don't get good results when I export from Logseq to anki, not to mention that it also breaks org-roam)
@v-Nyo I'm not familiar with Logseq -- does it support syncing to org-mode?
@eyeinsky Sorry should have explained more. Logseq is a plaintext knowledge management system like org-roam. It supports markdown AND org-mode. In Logseq I just need to select my org-roam dir and everything just works (with minimal configuration in emacs https://coredumped.dev/2021/05/26/taking-org-roam-everywhere-with-logseq/)
I am using Logseq on the go (emacs on android and emacs in termux don't work for me). But I basically write everything in emacs and just use Logseq to view my notes and do flashcards + a couple other things.
Logseq also stores some flashcard stuff inside the drawer of the heading. A card looks like this:
* How do you create a paragraph in html? :card:webdesign:
:PROPERTIES:
:card-last-interval: 1
:card-repeats: 1
:card-ease-factor: 2.36
:card-next-schedule: 2023-12-08T10:27:30.737Z
:card-last-reviewed: 2023-12-07T10:27:30.738Z
:card-last-score: 3
:END:
** You use the <p> element. here is an example:
#+begin_src html
<p> Hi </p>
#+end_src
I want to switch to anki because it already supports FSRS (Ankidroid will in the next release) and Logseq has the issues mentioned above.
Hey, do you still want to implement this?
In about 4 Months I might finally have some time to learn elisp. I still really want this feature, so I would appreciate some advice on where to start / how best to go about this
Yes, this feature still makes sense. I haven't currently had time to implement it or even look at how to do it :(, but if you could help, that would be great!
If you're just starting out with elisp, then a way forward could be that you create a branch in git, then add some stub content to it, then push it and create a draft pull request against this repo -- then in the pull request comments we could do the whole development.
A good first target would be to add a function org-anki-sync-subtree
which would create a card where org entry title would be the Front and the entire content (including subheadings) would be the card Back.