Anki Forums

Escape :: in cloze content

Hello, I think the topic has been raised a few times, and it seems impossible to escape :: inside the cloze content. This is particularly troublesome when the close contains computer code (usually inside pre and/or code html tags) since this makes the usual workarounds with html escapes as   unusable. At the moment I used the similarly looking ⁚⁚ (two dot punctuation) symbol.

the :: symbol is unfortunately very common in various programming languages (eg. C++, Rust).

is there any proposals to work on this? I think the cloze syntax could be augmented to specify different escapes without breaking backwards compatibility.

What do you think?

You could insert a zero width space in the middle of the colons to avoid changing the appearance. The editor could theoretically do that automatically for you, but it would mean it would break things for users who type the hint first, then select the cloze and use the shortcut.

Hello dae, thanks for you answer and for you work on anki. I was using the html escape entities for the zero-space, but that did not work because the cloze content itself was inside pre and code tags that make those html escapes visible.

I have now tried using the actual unicode value and it is a reasonable workaround.

If anybody else finds this useful, I have it working using AutoHotKey and the following shortcut entry

:?*:!!c:::{U+200B}:

which inserts colon-zero-space-colon whenever I type !!c

1 Like