-
Notifications
You must be signed in to change notification settings - Fork 190
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
Anki Cloze syntax #93
Comments
Hello, |
& what do you mean by:
I've also been thinking of adding options to disable certain flashcard styles the user isn't using (the regex scanning is a tad too slow). |
Thanks! No, a more compact syntax has two problems:
Here is an example that would suffer from both of the above problems:
What I actually want is: |
I would appreciate and utilize these options! |
Aah, I see. I hadn't thought of that. Thanks for your input! |
i love this idea. i use the cloze sytax more ofthen like this: {{c1:This text}} would {{c1:generate}} {{c1:1 cards}}. i like put multiple cloze in one card. looking forward this feature~ thanks. |
Yeah, having this feature work like Anki is a good idea. For example... If {{c1: you}} add clozes to a {{c1: card}} like this, then the the first two {{c2: will}} close together. This makes two cards. The first card will have two clozes: "you" and "card" simultaneously. The second card will cloze text "will". |
I had a similar suggestion too. Something like this Which would be equivalent to: This would give us a clean note to read and have our hints too. Eg. too many symbols in the preview mode isn't really good, but with this, the hints(which are really basic words like 'year'. 'article', 'number' etc...) would be hidden from the immediate view. Similar arrangement can be done for assigning the number of cloze. with a comma or something inside the footnote. |
Also interested in more in depth cloze support. Really the only functionality I need is the ability to hide multiple sections in a text block. Your example of Ideally I'd like the ability to have all three blocked like so: This request from @domkm, would solve this. Thanks again for your work on this! |
As @dummifiedme suggested, I would love to use footnote syntax to identify cloze numbering. Mainly because it generates a very clean and nice preview in Obsidian. One suggestion is So it can still have hints, like that: |
@MotaOcimar What I was suggesting helped rid of the number as well. Directly type in the hint on the footnote |
Hi @dummifiedme! You are correct, you already suggested a good way to number the clozes and give tips at the same time. Sorry, I missed it Compare:
The second suggestion seems more discreet in edit mode to me. Look: The first number in the footnote indicates that the highlights belong to the same cloze |
@dummifiedme and @MotaOcimar, in addition to hints, footnotes can provide a succinct way to define the Cloze Obviously, Re: cloze numbering with footnotes, since markdown footnote identifiers can be any alphanumeric sequence, Generally speaking, the design should not require the user to use any specific numbering or naming convention... ...except in the case of trying to define each cloze's hint in the footnote id, which I think is a good idea. :-) Note, however, that cloze hints may commonly be duplicated in multiple cloze notes. So, prefixes or suffixes might need to be used to make their corresponding footnote ids unique. Or, as @MotaOcimar suggested, perhaps we use separate footnotes for hints and extra. Perhaps the convention is simply:
Clozes that want to define a hint would use Note that in this scheme the hint footnotes don't really need a body, since their information is conveyed through their id. However, at least on GitHub, they don't render unless there is a complete footnote reference/body pair. In the example below, I include them with empty bodies so they'll render. Note that the footnote syntax described above doesn't need to be restricted to highlight-clozes only. In theory, you should be able to define cloze hints and Extra/card backs using highlight and/or Anki {{cloze}} syntax to define the clozes themselves. I vastly prefer the highlight form bc it sticks to standard md syntax, so I'll show that as an example below.
which renders like this (sorry GitHub md doesn't seem to support highlights): The ==rain==12 in ==Spain==3 falls mostly in the ==plains==4. The footnote bodies would look like this in markdown/edit mode:
(See bottom of comment for rendered footnotes) Since this issue is really about adding support for Anki cloze syntax, I might create a new issue for the footnote syntax.
@DaveyUS, I believe this is already supported. Perhaps this aspect got implemented in another PR after your comment. I'm using v0.14.6. Footnotes
|
Added from #552, opened by @Celeblith Problem Currently each cloze segment (highlighted or bolded portion of a card) creates a separate card. So if an entry has three clozes, three cards will be added to the deck, one for each cloze. Which is great sometimes as it makes creating contextual cards for language learning much more efficient. But ... It would also be nice to have an additional and alternative cloze that allows multiple cloze replacements to appear on the same card. This is useful for cards where multiple segments of the card go together. For example, when creating cards for Latin, I might make a card like:
In the above card, the endings of mīlitum and fortium agree with each other, so correctly answering the card would require supplying both endings at the same time. However, if I made this entry, it would instead create two separate cards, bloating my deck and making the cloze less valuable. My current workaround is to make cards like this one:
The problem with this workaround is that it takes much longer to make the card, the color and format of the italic blanks does't match the usual blue, non-italic clozes, and italicizing brackets sometimes does weird things to my formatting. Most of these issues are aesthetic, but multiple clozes per card would still be a nice feature nonetheless. |
Added from #496, opened by @putzwasser Is your feature request related to a problem? Please describe. Describe the solution you'd like Consumer surplus is the difference between {==the maximum price== a consumer is willing to pay and the ==actual price== they do pay} The flascard would look like: Consumer surplus is the difference between […] a consumer is willing to pay and the […] they do pay You'd have to answer all blanks at once and the answers get shown at once. So, all clozes within { and } get “combined” and hidden/shown together. As my flashcards are separated from my actual notes, I'd have no problem by adding some wrapping curly braces. For people who mix/store their “content” notes and flashcards within the same note the syntax could be %%{%%Your ==multi== clozed ==completion==%%}%% This is more verbose, but it hides the curly braces if you're just reading the note. |
In Obsidian_To_Anki-plugin the cloze deletion is implemented using this regex.
From this Github issue |
Sir, I found someone else had soved this problem, aosr, this plugin based on obsidian-spaced-repetition can recognize tag "#multicloze" to display multicloze, but other functions in that plugin changed a lot, I didn't like it, I beg you to incorporate "#multicloze" function from aosr, thanks a lot. |
I'm working on an implementation to solve this issue. I'm kind of busy these days, so I can't promise this will be finished soon. But I hope to have a solution here 🙌 |
Here's an Anki cloze parser, inspired by the original source in pure TS. There is currently one bug that needs to be addressed and then can be copy-pasted into the plugin (view more information at the bottom of the file). I've tested the code against Anki's test cases and everything else seems to work though. The code probably can be optimised a little too. Hopefully someone can do some more work on getting this to work, I will be working on it later but not sure when so posting it here... Edit: Thanks to a previous suggestion using regex, here is a full working parser (add onto the end of test file). I will create a PR later... // Converts text to cards
const regex = /((?:.+\n)*(?:.*\{\{[^\{\}]*::[^\{\}]*\}\}.*)(?:\n(?:^.{1,3}$|^.{4}(?<!<!--).*))*)/gm;
function text_to_cards(text: string): Card[] {
let cards: Card[] = [];
for (const match of text.match(regex)) {
const cards_match = tokens_to_cards(parse_anki_tokens(text_anki_tokens(match)));
cards = cards.concat(cards_match);
}
return cards;
}
// Testing
console.log(text_to_cards("foo\n\nhello\nstuff {{c1::Canberra was {{c2::founded}} {{c2::hello}}::hint}} in 1913")) |
Yay! I've finally opened a PR (#943) to address this issue. Your feedback would be greatly appreciated. It's a draft PR, so it's still a work in progress. But I believe it's now possible to run some tests and experiment with it a bit. Please let me know what you think! |
Hi, I've just made a release v1.13.0 that ships with custom cloze patterns 🥳 all thanks to #943. The updated documentation is live here. I've tested the release but not as extensively as I normally would. Perhaps we need a beta version of the plugin? That being said, I'm on standby to fix bugs ASAP. Just give me a shout. Cheers. |
Hi Stephen,
Thanks again for providing and maintaining this great plugin!
My preferred card style is Cloze because they support any number of "sides". For example, in Anki,
{{c1:This text}} would {{c2:generate}} {{c3:3 cards}}
. I don't use this plugin's Cloze functionality because it only supports 1 side and uses Markdown highlighting syntax, so I even avoid using highlights because I don't want them to turn into Cloze cards (it's an anti-feature for me). Would you consider supporting Anki's Cloze syntax?The text was updated successfully, but these errors were encountered: