Skip to content
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

Custom faces for Anki's cloze syntax #80

Open
bnjmnt4n opened this issue Nov 13, 2020 · 1 comment
Open

Custom faces for Anki's cloze syntax #80

bnjmnt4n opened this issue Nov 13, 2020 · 1 comment

Comments

@bnjmnt4n
Copy link

I'm pretty new to Emacs, so please correct my understanding if I make any mistakes.

Currently inserting clozes using Anki's cloze deletion syntax {{c1::....}} leads to a lot of extra noise in the Org file. It would be great if there were some sort of way to mark this syntax as an Anki-related face, so they can be de-emphasized if desired. My understanding is that Emacs has a faces mechanism for this. I'll do a bit of reading to see how something like this can be done, but just wanted to post this on the issue tracker to see if anyone has done anything similar or has any suggestions.

@meedstrom
Copy link

meedstrom commented Feb 10, 2022

I agree about visual noise. Here's a basic approach, though it'll affect all modes.

(font-lock-add-keywords nil '(("{{c.::" . font-lock-comment-face)
                                             ("}}" . font-lock-comment-face)))

An alternative is to use prettify-symbols-alist to hide these parts entirely. Side note, prettify-symbols doesn't allow regexps, so you'd you need a rule for each of c1::, c2::, c3::... up to some appropriate max (c30?).

A second alternative is to just make square brackets [] a shorthand that anki-editor will automatically turn into {{cN:: in incrementing order upon push, so it has the same look and feel as org-drill. Of course it'd be clumsy if you want to reuse the same N in several sentences, but the user could just type out the proper syntax in those cases. It'd also be unclean when editing a mature note and removing some clozes, as the numbers will change. I wouldn't be concerned if I did this as part of a fork aimed at minimal visual clutter (e.g.: cloze is the only note type allowed, with only one field, so you need no subheadings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants