fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.63k stars 262 forks source link

Add support for Anki templating #1246

Closed jthulhu closed 2 years ago

jthulhu commented 2 years ago

Hello, after passing some time on an Anki forum, I realized lots of people edited Anki templates in external editors (including Emacs, which already has an anki minor mode that makes the bridging), so I though it made sense requesting for it to be supported in web-mode. For information, Anki is a memorizing application, which relies on webviews, and so it has a templating mechanism on top of regular HTML / CSS / JS. The documentation about the templating specs can be found on the website.

fxbois commented 2 years ago

Could you post an example on gist that contains many of the features of the template language please

jthulhu commented 2 years ago

Sure, although I am not myself a heavy user of these templates, so I might miss some. I submitted this so, if it is actually implemented, I can recommend Emacs with this fantastic mode on that forum. Here is the gist.

fxbois commented 2 years ago

@TheBlackBeans what is the file extension for those templates ?

jthulhu commented 2 years ago

There is no file extension, as Anki does not (natively) support importing templates from files. I used to allow external editors to edit this, but it's not really a used feature anymore (it would create a temp file with no extension, and call an editor on that). The main way to edit these things with Emacs is through org-mode, with support of a dedicated minor mode and org-babel, so there really never is a file extension.

jthulhu commented 2 years ago

I think that once there is an implemented version of an IDE which specifically has support for Anki templates, the community will start using more external editors (currently, due to the templates' syntax breaking IDE support, most Anki users only edit snippets of code in their IDE that does not include weird stuff), and so maybe it will pick an appropriate file extension. Besides, if you have anything to propose — as you seem to have experience with these template languages...

fxbois commented 2 years ago

I've pushed a commit to support .anki templates

jthulhu commented 2 years ago

Fantastic! I'll test it myself, of course, but I'll also make a post on the forum (forums.ankiweb.net if you're interested) so those interested will be able to provide feedback.

fxbois commented 2 years ago

yes of course, it is important to make this known by the AnkiWeb community

cicerojones commented 2 years ago

I hope no one minds my linking in this thread to that very post, for those who are interested:

https://forums.ankiweb.net/t/anki-templates-support-for-emacs-web-mode/20793

Fantastic! I'll test it myself, of course, but I'll also make a post on the forum (forums.ankiweb.net if you're interested) so those interested will be able to provide feedback.