jefdongus / insert-symbols-anki-addon

Anki add-on to insert Unicode symbols into cards.
https://ankiweb.net/shared/info/2040501954
24 stars 10 forks source link

feature suggestion : using this to make macros #5

Closed thiswillbeyourgithub closed 4 years ago

thiswillbeyourgithub commented 4 years ago

Hi,

I'd like to use your great addon to make macros, for example I very often have to enter a sequence of keys to add this : screenshot

The corresponding characters for this are : <div>{{c1::</div><div><ul><li><br></li></ul></div><div>}}<br></div>

But your addon replaces every < with &lt and > with &gt. Would you be interested in changing this behavior ?

Thanks !

thiswillbeyourgithub commented 4 years ago

No opinions :)?

jefdongus commented 4 years ago

Hey, sorry haven't had a chance to work on this project until now. So the issue I'm worried about is that most users probably don't know HTML, so if < and > characters don't get escaped (converted to &lt; and &gt;) by default, the plugin would be non-intuitive to use / break for the users who want < and > to show up on the card.

Perhaps a future step would be to add special code blocks which would be delimited by a special set of characters, but that could also cause problems for users who happen to use those as keys. I'm open to suggestions!

thiswillbeyourgithub commented 4 years ago

Hi, thanks for the answer.

What do you think of allowing escaping, so people using < and > wouldn't see any change but more advanced users could use \> to parse html.

basically : if a < is preceded with a \ then don't convert it to &lt; but only remove the \ : < becomes &lt; \< becomes <

That's assuming people who don't want to use html wont try to use weird combinations like \<. If you are not willing to do this maybe another approach would be to encapsulate any html code within @HTML:[]. Everything inside the brackets will be left as is (so a > stays a >).

What do you think of both approach ?

jefdongus commented 4 years ago

Upon further thought, having HTML blocks would be better since that would be a more flexible approach (some other users have mentioned wanting super/subscripts for example). I'll put it on the to-do list, but it'll probably take a couple of weeks or so for me to get to it.

thiswillbeyourgithub commented 4 years ago

Thanks, that would be incredible as it could allow for endless macros!

Also do you accept (small) donations ? I might be interested if it incentivises you :)

jefdongus commented 4 years ago

No need for donations :) Since I'm a medical student, the limiting factor really is just time!

thiswillbeyourgithub commented 4 years ago

I am as well so I understand. Thanks anyway!

jefdongus commented 4 years ago

Ok, this should work now! Please let me know if you run into any bugs.

thiswillbeyourgithub commented 4 years ago

I missed your message, sorry!

I am not sure I understand, you did the modifications and allow for macros ? If yes I don't understand how I'm supposed to do it.

edit : I checked your commit. Thanks a lot :) I have to surround the blocks with :: and :: right? I'll get back to you if I'm having trouble.

Have a nice day!