joeyuping / quick_latex_obsidian

MIT License
327 stars 21 forks source link

Auto delete and auto close of $ #74

Closed vzsky closed 1 year ago

vzsky commented 1 year ago

I have been using this plugin for a while and really love it. Some suggestions.

The plugin will type $$ and insert the cursor in the middle when a single $ is pressed and that's expected. But I think a better way to delete the $$ sign is to delete them both if the cursor is in-between two signs. Like when deleting a parenthesis when the cursor is between two lines. $|$ + backspace => | and $$| + backspace => $|. where | denotes the cursor position.

Another suggestion is not to autoclose $ in some scenario. Like, if somehow the state of the text is "$ \someformula" add the user trying to add the closing $ tag, it should not be autoclosed. I understand that it might be hard to detect the open $ symbol.

Any idea about this?

joeyuping commented 1 year ago

thank you so much for these suggestions! indeed. will look into them

joeyuping commented 1 year ago

Hi! @vzsky

Sorry for the really late update!

Please see v2.6.1. Deletion of $ symbols will now do in pairs. As for the second suggestion, where there are dangling $ to be closed, I added a test for odd number of $ in the same line. In that condition, the $ will not be autoclosed.

Please see if this works for you~