artisticat1 / obsidian-latex-suite

Make typesetting LaTeX as fast as handwriting through snippets, text expansion, and editor enhancements
MIT License
1.43k stars 56 forks source link

[BUG] context object support in js #300

Closed MohamedDhiaSleimi closed 5 months ago

MohamedDhiaSleimi commented 6 months ago

Description

context object does not work in js code

To Reproduce

example snippet does not work tried to put it in its own file to isolate the problem still did not work { trigger: ":", replacement: (context) => { const currentLine = context.editor.getLine(context.editor.getCursor().line); const currentIndentation = currentLine.match(/^\s*/)[0]; const additionalIndentation = currentIndentation + "\t"; return :\n${additionalIndentation}$0; }, options: "c", description: "Replaces : with : followed by a newline and one more tab than the current line's indentation" },

Expected Behavior

the expected behavior of the snippet is that inside a code block by typing :\t it will create a new line with an extra indentation compared to the current line

Platform

obsidian v1.5.12 Latex Suite v1.9.3

bdm-k commented 5 months ago

There are three types of function snippets available, but none provide the context object you mentioned. I think there might be some misunderstanding. Docs

MohamedDhiaSleimi commented 5 months ago

Sorry i forgot and left the issue open did not mean to.