tth05 / obsidian-completr

Auto-completion plugin for the obsidian editor.
MIT License
303 stars 18 forks source link

LaTeX Provider in separate file #11

Closed tomerganz closed 2 years ago

tomerganz commented 2 years ago

Hi! First of all thank you for the plugin, I'm loving it and finding it very helpful! Since I'm using custom LaTeX commands via Extended Mathjax, I would find it really helpful if the LaTeX provider was separate to the main.js file, or perhaps even using a separate file for the custom commands (although, I do find myself changing \underbracket{#} to \underbracket{#}_{#} for example, so modifying the original provider is also quite useful IMO). Again, thank you for all the work! 😄

tth05 commented 2 years ago

Good idea! The plugin will probably export all default suggestions if the file doesn't exist and otherwise just load whatever is in it. I'm thinking of using a simple JSON format

[
    "\\thing",
    "\\thing2",
    {
        "displayName": "\\thing",
        "replacement": "this thing is not what it seems like"
    },
    "\\mathbb{P}"
]
tomerganz commented 2 years ago

Thanks for the reply! My understanding of JSON is lacking to say the least, but you suggest both the function of adding more completion options and a replacement option? i.e completing/choosing $\thing$ will result in this thing is not what it seems like? And could it grant the function of changing the suggestions in the original provider? Like the change I found I needed in \underbracket{#} to \underbracket{#}_{#}

tth05 commented 2 years ago

My understanding of JSON is lacking to say the least, but you suggest both the function of adding more completion options and a replacement option?

Yup, exactly. Once I find time I might start writing some wiki pages to explain all configuration options a bit more in depth.

ndharari commented 2 years ago

Hi! I manually added my macros to the main.js file and it worked great. If not a separate file, we could add a list of commands in the correct format in the settings pane and that would be also fine. Adding environments was just as easy!

tth05 commented 2 years ago

Implemented in 92d4142b8015f884d8211548127c973efc8465ae. Check the README for a description