LaTeX-Utilities icon indicating copy to clipboard operation
LaTeX-Utilities copied to clipboard

Enable Live Snippets for More Language Mode in Addition to LaTeX

Open MatrixRanger98 opened this issue 3 years ago • 8 comments

Feature Request

Is your feature request related to a problem? Please describe.

I would like to write TeX math in Markdown/RMarkdown/Quarto files as well and the live snippet is really a great feature. It saves so much time. I wonder if we could activate this extension for Markdown/RMarkdown/Quarto as well.

Describe the solution you'd like

"activationEvents": [
 "onLanguage:tex",
 "onLanguage:latex",
 "onLanguage:doctex",
 "onLanguage:markdown",
 "onLanguage:rmd",
 "onLanguage:quarto"
]

Then add a setting that could disable the extension for Markdown/RMarkdown/Quarto.

MatrixRanger98 avatar Aug 11 '22 00:08 MatrixRanger98

By the way, I want word count and formatted pastes for Markdown as well. But such features are provided by other extensions already (though I think supporting them here is a cleaner solution). The live snippet is a unique feature that I haven't seen anywhere else and I like it very much.

MatrixRanger98 avatar Aug 11 '22 00:08 MatrixRanger98

Most math-related live snippets only works in latex, and due to difficulties in parsing them, they are even not supported in $$. Supporting them in markdown would be fairly difficult. If someone can come up with a solution (PR welcomed!) that can parse and handle inline math formulas like $$, then I think it would be reasonable to support live snippets in markdown.

leoleoasd avatar Oct 03 '23 20:10 leoleoasd

Yes. But supporting those non-math-related ones is already good enough for daily use. For now I am using a workaround by modifying the local source codes in LaTeX Utilities to let it regard Markdown as LaTeX. But I need to redo the trick after each update. It would be great just to have the option of activating the extension in Markdown. To be honest, most math-related ones are not that useful. My use case is mainly replacing ^{} and _{} by some two-key trigger. This speeds up math writing immensely.

MatrixRanger98 avatar Oct 03 '23 20:10 MatrixRanger98

Can you try open a blank .tex file in your markdown project then see if live snippets work in markdown?

leoleoasd avatar Oct 03 '23 20:10 leoleoasd

No. It doesn't work. If you look at the source code of Latex utilities, even when it is activated, the live snippets only react when the document is LaTeX. There is a judgment step in the code.

MatrixRanger98 avatar Oct 03 '23 20:10 MatrixRanger98

Yes, this line image I don't think adding markdown to activationEvents is a good idea because it will make everyone that writes markdown loads a slow extension. Do you think that, add a command that does nothing but loading the extension, and allow setting language ids for live snippets a good approach?

leoleoasd avatar Oct 03 '23 20:10 leoleoasd

Yeah that is good approach. I would appreciate it if the change can be made.

MatrixRanger98 avatar Oct 03 '23 20:10 MatrixRanger98

I too would love this!

mayurankv avatar Nov 04 '23 17:11 mayurankv

Just wondering if this could be implemented soon. Thanks! It would help save a lot of time.

MatrixRanger98 avatar Mar 22 '24 17:03 MatrixRanger98

I'll see if I can squeeze some time this weekend

leoleoasd avatar Mar 22 '24 19:03 leoleoasd

image

I'll try to publish it tomorrow....

leoleoasd avatar Mar 25 '24 05:03 leoleoasd

@MatrixRanger98 This should be fixed now.

leoleoasd avatar Mar 26 '24 19:03 leoleoasd