evesdropper / luasnip-latex-snippets.nvim

A set of preconfigured snippets for LaTeX for the snippet engine LuaSnip.
https://evesdropper.dev/files/luasnip/
MIT License
66 stars 8 forks source link

Using the Snippets in markdown files #1

Open frogiraffe opened 11 months ago

frogiraffe commented 11 months ago

Is there any way to make the snippets work in markdown files like they did in here. I use obsidian to take notes so i only use "$$math$$" in the markdown files. I tried to understand how it works but unfortunately im not experienced with custom snippets

evesdropper commented 11 months ago

Ah yes, this is currently not supported - there are two ways to solve this: either extend tex snippets to markdown, or make some changes to the current snippet expansion conditions so it works seamlessly on markdown. I'd like to implement the latter, and it'll involve some treesitter code, which I'm not immediately familiar with. That being said, I'll do my best to add it in soon, and I'll let you know when changes have been pushed.

no-vici commented 3 months ago

Is there any way to make the snippets work in markdown files like they did in here. I use obsidian to take notes so i only use "$$math$$" in the markdown files. I tried to understand how it works but unfortunately im not experienced with custom snippets

Put this line some where above you snippets in markdown.lua:

-- in a markdown file: search for json, then tex or anything else you'd like it to.
require("luasnip").filetype_extend("markdown", { "json", "tex" })

Then hook the conditions or something similar to Conditional expansion into your markdown without worrying about VimTeX.