debanjandhar12 / logseq-anki-sync

An logseq to anki syncing plugin with superpowers - image occlusion, card direction, incremental cards, and a lot more.
GNU Affero General Public License v3.0
465 stars 34 forks source link

Allow one card per note using Logseq's Cloze Macro Syntax #193

Open aforank opened 1 year ago

aforank commented 1 year ago

Describe the solution you'd like For creating cloze cards, I want to stick to the Logseq's cloze macro syntax. The problem I am currently facing is that it creates multiple cards if more than one clozes are present in a block. This defeats the purpose of learning that block because it shows all other clozes while reviewing any card.

The solution is fairly simple.

Currently when a Logseq cloze is converted, it appears like this in Anki

Hello {{c1::World}}. How may I {{c2:: help}} you

Instead of that, create all clozes with c1 as shown below, and Anki won't create multiple cards.

`Hello {{c1::World}}. How may I {{c1:: help}} you.

Describe how it will help your workflow My cards in Anki would behave the same way it currently works in Logseq.

jaker-dotcom commented 4 months ago

I think that pointing you to #18 could solve the issue?

jaker-dotcom commented 4 months ago

In essence write Hello World. How may I help you? replacecloze:: " 'World', 'help' " for two cards

and

Hello World. How may I help you? replacecloze:: " /(World|help)/gi "

for one card

Think you can even mix the two e.g. replacecloze:: " 'World', /(World|help)/gi " should create one card with both clozes and one with just World clozed out.

This uses regex within the slashes. And the slashes stuff works like sed or vim. e.g. the g means global, so all appearances of either World or help are clozed, not just the first and i means case insensitive

jaker-dotcom commented 4 months ago

Tested and it is also possible to just write Hello {{c1 World}}. How may I {{c1 help}} you?

Just make it the same number for one card and different numbers for two / multiple cards.

If you prefer not to use regex / it's quicker. But doesn't work in latex math mode.

jaker-dotcom commented 3 months ago

I know this is no longer to answer the original question but for reference: You can also use two regexes separated by a comma to create two cards, e.g.

Conditional Expected Value of $Y_1$ is replacecloze:: "/(?<=})y_1/g, /(?<=d)y_1/g" $E(Y_1|Y_2 = y2) = \displaystyle \int{-\infty}^{\infty}y_1 f(y_1 |y_2) dy_1$

Also why not close the issue? Is none of the above suited for your use-case?