logseq-anki-sync icon indicating copy to clipboard operation
logseq-anki-sync copied to clipboard

support for custom note type (field by field)

Open thiswillbeyourgithub opened this issue 3 years ago • 13 comments

Hi,

(I am surprised to see I seem to be the first to ask for this. If I missed the other requests I apologise. Related to #33 and #34 )

Can you consider implementing a way to specify the note type to import to? This would go with a way to specify each field separately.

I'm thinking it would be not that hard using block properties :

#card
notetype:: my_note_type
field1:: foo
field2:: bar

edit : actually maybe multiline field content would be an issue in properties? I don't know I'm rather new to logseq

Going the extra mile: use anki connect's methods "modelNames" then "modelFieldNames" to get the list of all note types and add created related templates.

context: I am badly needing #34 to the point of planning to learn javascript just to implement this feature before next uni semester starts around september. And I know it would be way easier to implement it the way I want to if there is already a way to specify each anki field in logseq directly.

Thanks a lot!

thiswillbeyourgithub avatar May 04 '22 11:05 thiswillbeyourgithub

_edit : actually maybe multiline field content would be an issue in properties? I don't know I'm rather new to logseq

Yes it will be an issue

debanjandhar12 avatar May 10 '22 08:05 debanjandhar12

One block per field would also work. Though properties can be defined per block like so:

* this is the first (default) field #card
  note_type:: my_note_type
    * this is a 2nd field
      field:: source_field
    * this is the more field
      field:: more

This would be easy to fill using template I think. And those templates could be generated from a query to anki connect that gathers the model list and fields.

thiswillbeyourgithub avatar May 10 '22 15:05 thiswillbeyourgithub

Why not use regular expressions for this purpose ? It is very versatile and fast enough even for a lot of files.

Spiralo-Idioide avatar Mar 14 '23 13:03 Spiralo-Idioide

Why not use regular expressions for this purpose ? It is very versatile and fast enough even for a lot of files.

I agree.

@debanjandhar12 what are your thoughts on this ?

thiswillbeyourgithub avatar Jun 05 '23 17:06 thiswillbeyourgithub

Need this feature!

BilderLoong avatar Jun 21 '23 10:06 BilderLoong

I gave it some more thought and what I now think is that the best possible setup would be a template engine. By that I mean something like what can be found in the omnivore plugin : image

Basically a template would allow to specify that the cloze section would go to fieldA, any sub block to fieldB, the parent would go to field C etc.

Having several templates would allow for proper "note types", for example I frequently create cloze cards as child of a block that contains only a picture. In anki I would love to have the picture appear in a field that is hidden by default as it's actually the source material (ie containing the answer).

I know that it's a significant feature but it seems important to me.

thiswillbeyourgithub avatar Jun 21 '23 12:06 thiswillbeyourgithub

[BOUNTY BELLOW]

Hi, I think it would be a great step forward to simply stop uploading the note type on every sync.

I suggest the following execution for every sync :

  1. Use the modelNames action of anki-connect to get the list of models in the collection
  2. Check if there is a model named '{graphname}Model', if no : use the action "createModel" to upload it.
  3. Upload the cards as usual using addNote

Additionaly, adding a few new buttons in the settings to Edit the Front, Back and Styling html/css of the original note type.

For implementing this, I offer a bounty of $25 but encourage other users to do the same and pool or wallets together to show our motivation :)

Why ?

  • This would let the user free to customize the notetype without having it be erased on every sync.
  • we could have the same text in an anki field as in logseq, without having all the hierarchy cluttering the anki browser (the hierarchy would be saved in a "hierarchy" field and displayed only if "show_hierarchy" field contains anything (this is very simple to do as Anki supports conditional display of fields natively)).
  • We could have a block level property to toggle wether we want to see the parent or not (having to set this property graph wide is really bad in my opinion as it often shows the answer)
  • Supporting other fields and other note types would be very easy because we could just add a block property to specify the model name.
  • Finally, it might make it possible to implement (wayyy further down the line) a bidirectionnal sync as the actual markdown content and anki field content would be pretty minimal (for more discussion see https://github.com/debanjandhar12/logseq-anki-sync/issues/34)

This would be a good step towards #33 , #164 also

Thank you very much for reading this and have a nice day.

thiswillbeyourgithub avatar Sep 15 '23 15:09 thiswillbeyourgithub

Hi, this proposal makes sense to me and seems very valuable. I am willing to add $25 to the bounty if that helps make it a reality. Thanks!

HolaParis avatar Sep 22 '23 04:09 HolaParis

Any update :) This lack of ability to use specific note type is stopping me from using text to speech as I do in my other note type :/

As a reminder: the bounty is currently at $50 :heart: :)

thiswillbeyourgithub avatar Oct 04 '23 14:10 thiswillbeyourgithub

Hi, I too am in dire need of this feature and @thiswillbeyourgithub 's outline seems like a good idea. If this can help I am pledging $25 too. This makes the total bounty at $75. Have a nice day!

ludovicmodjo avatar Oct 12 '23 13:10 ludovicmodjo

Will take a look into it this week.

debanjandhar12 avatar Oct 16 '23 14:10 debanjandhar12

Hi! Any update on this :)?

thiswillbeyourgithub avatar Dec 28 '23 14:12 thiswillbeyourgithub

Absolutely necessary +1

navakelvin avatar Mar 16 '24 19:03 navakelvin