obsidian-latex-suite icon indicating copy to clipboard operation
obsidian-latex-suite copied to clipboard

[FEATURE] Prevent double backslashes when replacing a snippet

Open RyotaUshio opened this issue 9 months ago • 3 comments

Hi, thank you so much for this great plugin!

Description of the Problem

Let's take {trigger: "sum", replacement: "\\sum", options: "mA"} as an example.

For me, it's difficult to be consistent enough to refrain from typing \sum instead of just sum. Most of the time I type just sum, but sometimes I carelessly type \sum, which results in double backslashes, i.e. \\sum.

Description of the Solution

It would be great if this plugin had the option to disable replacement when there is already a backslash so that the result will be \sum regardless of whether I typed the backslash or not.

Additional

I could partially resolve this problem by replacing the snippet with {trigger: "[^\\\\]sum", replacement: "\\sum", options: "rmA"} but it inserts \sum at an unexpected position:

https://github.com/artisticat1/obsidian-latex-suite/assets/72342591/07f4f094-2049-44cd-9c45-4da6b685dedc

RyotaUshio avatar Sep 27 '23 09:09 RyotaUshio