Closet For Anki [Official support]

Hi just wanted to ask how this could be done

anterior border [[mc::pectoral::scapular||costal||humeral]]
posterior border [[mc::scapular::pectoral||costal||humeral]]
medial border [[mc::costal::pectoral||scapular||humeral]]
lateral border [[mc::humeral::pectoral||scapular||costal]]

im not sure how to make a card wherein all 4 are active without mixing the choices with the other lines. please help

1 Like

@carlratcliffe I would recommend using the sort filter (example) here, because it allows you to avoid repeating the options:

anterior border [[sort0::pectoral]]
posterior border [[sort0::scapular]]
medial border [[sort0::costal]]
lateral border [[sort0::humeral]]

@OjisanSeiuchi Right now it would require you to configure it using JS, like in this example. This is true for the current version. In the upcoming version, which is already close to release, you will be able to style it using just CSS. So you can look forward to that :slight_smile:

I’ve added the source code of shuffling to asset manager but I can’t seem to get sort to work

is it also possible to make the font-weight into bold?

@carlratcliffe

Have you installed it correctly? In the setup in Asset Manager, change it like this

filterManager.install(
    ...multiple lines...
    closet.recipes.sort({ tagname: 'sort' }),
)

Concerning bold: What exactly do you want to make bold? If you just want to have bold text, I’d suggest using the built-in Anki “bold” button, to make text bold. Closet only makes sense, if the styling is dynamic (e.g. is different between front and back of the card), or has a random component to it.

I’m sorry for the late reply. what I meant was to make the cloze bold automaticallly when adding from template. figured it out though by adding font-weight on closet setup.

just wanted to ask, is it possible to make a card, with multiple front fields? wherein front (1) will show c1 c2 c3 while front (2) will be ch1 ch2 ch3?

How does it compare to the “conventional” Image Occlusion and Cloze Overlapper add-ons (by Glutanimate)? Do Closet overlapping and image occlusion have more features or less features, and which features are those?

Closet’s image occlusion editor is very basic at the moment. There is a lot of room for usability improvements, but for most use cases it it’s already sufficient. Regarding everything else (overlapping clozes, multiple choice, random number generation etc), Closet allows for pretty much anything you can think of. The creative freedom Closet provides is unmatched and cannot really be compared to any other addon.

Some Image Occlusion Advantages

  • no external editor (you can edit the occlusions directly from the Add-dialog)
  • creates multiple cards from one note - instead of an individual note for each rectangle, so Closet cards are linked like cloze cards
  • you can mix image occlusions with other effects (e.g. clozes):
  • show/hide specific rectangles on a per-card-basis (using the command fields)
  • you will never run into the issue of a “broken” note type - a thing that happens constantly with the traditional IO-Enhanced add-on
    I don’t think you’d miss this mess: image

Some Image Occlusion Disadvantages

  • requires basic understanding of how your actions within the editor are transformed into closet commands and how those commands affect the output → so it is not that user friendly
  • grouping multiple rectangles requires more effort and planning
  • advanced styling requires some coding knowledge (no out-of-the-box support for multiple colors, shapes etc.)
  • no undo functionality (Ctrl-Z)
  • still in early development, bugs may occur

Conclusion

I would say that Image Occlusion Enhanced by Glutanimate is a lot easier to understand and use, while Closet allows for the creation of cutting-edge Anki cards that were not feasible before and relieves you of the pain of managing multiple note types.

So whether it’s worth it for you could boil down to this question: What’s more important to you, ease of note creation or ease of note management?

The main "Selling Point"

The fact that you can use all of Closet’s features in a single note type makes Closet stand out. This is is a godsend when you use a lot of JavaScript and CSS in your template and you want to keep things consistent while adding new scripts and designs. This alone is worth the switch in my opinion.
The amount of features really depends on how you use it. It is a templating language, not a finished solution.

@hengiesel is one of the most active Anki devs, so Closet seems future proof right now.
Future versions will probably feature a lot of usability enhancements. If you have ideas and want to help in Closet’s development, you can file an issue on the GitHub repository.

4 Likes

Thanks you so much for your comprehensive review!!!

The creative freedom Closet provides is unmatched and cannot really be compared to any other addon.

I really like the idea of it. I remember that there was another add-on that similarly gave users lots of freedom. For example, you could make nested clozes. But I can’t seem to find it anymore.

I would say that many features either

  • randomize sth.
  • or give hints

I am mainly interested in Image Occlusion and (Overlapping) Clozes. For my purposes, I don’t see use cases for the randomization/hint features.

It would indeed be cool to eliminate the need for multiple note types (benefits: easier management, reuse Extra/context sections, recycle occluded images as backside context on cloze cards of the note, used cloze fields as backside context for IO?). I will keep an eye on Closet but for now I’ll stay with the tools I have.

This is is a godsend when you use a lot of JavaScript and CSS in your template and you want to keep things consistent while adding new scripts and designs. This alone is worth the switch in my opinion.

I do use some JS in a cloze notetype but I am not its creator and I don’t really understand it. I have once tried to incorporate it into the Cloze (Overlapping) notetype and it failed. I will reconsider Closet when I understand JS better. Thanks for mentioning this point!

1 Like

so is it possible to setup multiple front fields as independent cards in 1 note type?

lets say, for example:
{{front 1}} with {{cmd1}} is a separate card from {{front 2}} with {{cmd1}}?

@carlratcliffe
If I understand you correctly, it’s very possible.
However setting it up might not be that straightforward. The best way to help you, would you be if you set up a deck with a few cards, that have the fields like you want them, and then you sent that to me.

Since 2.1.41, I cant seem to get pictures into occlusion mode. Perhaps I am missing something, but closet is definitely enabled for the note type I am using.

Henrik hasn’t patched Closet for 2.1.41 yet:

image

The editor has been reworked, which is why Closet isn’t fully functional on this version. You’ll have to stick to 2.1.40 for a little longer.

An ETA would be nice though @hengiesel :smiley:

yep. I was mainly just not sure if it was an issue only I was having. Seeing as a lot of the changes were made by hengiesel himself, and there was no mention of incompatibility on the addon page. But other people are having the same issue it seems.

anyway thanks for the reply mate.

@kleinerpirat @Towel_Sniffer

I just updated Closet (and Asset Manager) for 2.1.41. If you look at the changelog, you can see why it took that long :sweat_smile: The new version is not just compatible with 2.1.41, but unfortunately also includes a few breaking changes.

If you come across any issues, don’t hesitate to post them here. I know it’s annoying to have to fix the setup, just to use the newest Anki version, but for me it was important to put out all those big changes, before AnkiDroid becomes compatible :slight_smile:

2 Likes

@hengiesel Porting the setup to the new changes wasn’t that bad. It’s good that you push these “breaking” updates while the userbase is still manageable.
Interested to see the new list wrapping in action!

In case anyone else faces a similar challenge,
here’s what it took for me:

  • To get the occlusion editor to start again, I moved the CSS-injecting parts from the Closet setup into the template’s styling section.

  • Then, I had to fix some advanced features of my type, which relies on these features:

With the Webview Inspector I saw that something calling “.show” was throwing an error. When taking a look at closet/src, I saw that cloze.ts was moved. So changing this function

const wrappedClozeShow = closet.wrappers.aftermath(closet.recipes.cloze.show, () => {
....
})

to
…(closet.flashcard.recipes.cloze.show, () => {…

fixed my note type :partying_face:


For debugging your setup, I recommend using the AnkiWebView Inspector on the add-dialog and preview + looking at closet’s file structure.

2 Likes

thanks hengiesel, Here is an issue I was having.

so with Incremental Reveal - The Closet Engine, as kleinerpirat suggests, I changed

closet.recipes.cloze.show

to

closet.flashcard.recipes.cloze.show

however this section:

closet.browser.appendStyleTag(`
.cl--obscure-hint {
  filter: blur(0.25em);
}

.cl--obscure-fix::after {
  content: 'XXXXXXXXXX';
  filter: blur(0.25em);
}

.cl--obscure-fix > span {
  display: none;
}`)

gives an error

image

My fix was to just add the CSS to the styling section of my templates (which is maybe what kleinerpirat is talking about when he says “I moved the CSS section from the setup to my template”?) and my templates work again.

2 Likes

@Towel_Sniffer

Just for information sake: The canonical way to insert styles would be internals.template.appendStyleAll(keyword, style_css), or internals.template.appendStyle(element, keyword, style_css). The inclusion guard is not necessary anymore, as this is done within the function. This makes sure it works, even if Closet is used within web components. This change was necessary, because the editor uses web components now.

1 Like


I had just updated to the latest version, and updated my ‘closet for anki’ too. Unfortunately, it seems not to be working. For some reason, it just highlights pictures when dragging and not to occlude anymore. I really appreciate this add on until just now, it didn’t work for the 2.1.42 (latest) version.

kleinerpirat’s previous post describes a fix for this

1 Like