ssricardo / anki-plugins

Contains a set of addons for the open source application Anki Desktop
95 stars 20 forks source link

Support zero-width space (\u200b) within cloze + minor fixes #131

Closed lightmotive closed 1 year ago

lightmotive commented 1 year ago

Support for a user-side "hack" that works around this issue. Others have asked elsewhere.

Ideally, Anki would allow some user-friendly way to include :: within a cloze deletion to be interpreted as content instead of as a hint separator. Perhaps I'll contribute to Anki one day to enable that; I would propose :::: be an escape sequence for literal :: content. In the meantime, this enables the fill-the-blanks add-on to support another cloze feature that Anki core doesn't yet support.

New unit test required

Example HTML excerpt where that's needed (Ruby language syntax practice; IPv6 is another use case, and other popular programming languages sometimes require ::):

{{c1::Net:​​:HTTP.get(uri)}}

Correct text input would be Net::HTTP.get(uri).

lightmotive commented 1 year ago

For reference, this Anki code splits cloze content and hint.

What would you think about temporarily replacing :::: in cloze content with a placeholder like __double-colon-placeholder__, then split content__double-colon-placeholder__[::optional hint], then replace __double-colon-placeholder__ with :: string after splitting?

If not in the Anki backend, how about supporting that in this add-on? Just say yes and I'll add the change to this pull request...

ssricardo commented 1 year ago

It took some time, but I now got back to this. I'm merging and testing it; and later will release it