Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support subheadings as content for Back of a card #66

Open
whatacold opened this issue Jun 4, 2023 · 13 comments
Open

Support subheadings as content for Back of a card #66

whatacold opened this issue Jun 4, 2023 · 13 comments
Labels
feature New feature or request

Comments

@whatacold
Copy link
Contributor

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.

@eyeinsky
Copy link
Owner

eyeinsky commented Jun 4, 2023

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.

@whatacold
Copy link
Contributor Author

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?

@eyeinsky
Copy link
Owner

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

@whatacold
Copy link
Contributor Author

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))))

@eyeinsky
Copy link
Owner

eyeinsky commented Jun 19, 2023

@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
Copy link
Contributor

basaran commented Jun 20, 2023

@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.

@eyeinsky eyeinsky added the feature New feature or request label Aug 25, 2023
@eyeinsky eyeinsky changed the title [Feature Request]Support subheadings as content for Back of a card Support subheadings as content for Back of a card Aug 25, 2023
@v-Nyo
Copy link

v-Nyo commented Dec 6, 2023

This would be awesome and also provide instant compatibility with Logseq (:card: tag).

@v-Nyo
Copy link

v-Nyo commented Dec 6, 2023

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)

@eyeinsky
Copy link
Owner

eyeinsky commented Dec 7, 2023

@v-Nyo I'm not familiar with Logseq -- does it support syncing to org-mode?

@v-Nyo
Copy link

v-Nyo commented Dec 7, 2023

@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/)

@v-Nyo
Copy link

v-Nyo commented Dec 7, 2023

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.

@v-Nyo
Copy link

v-Nyo commented Jul 17, 2024

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

@eyeinsky
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants