Open proItheus opened 2 years ago
Hello!
The snippets are perfectly valid JavaScript, so saving your snippet file as a .js
file should give you syntax highlighting. (However, snippets are actually parsed by the plugin using json5
. It's an extension of json
which adds support for comments among other nice features.)
In the future, I can consider changing the format if there is significant demand.
Is there a way to edit the .js
file in Obsidian with syntax highlighting? I know can I view the files in the file explorer by changing Files & Links > Detect all file extensions
to true, but then I cannot edit them in obsidian, it opens them in my external editor configured for that filetype.
Well, I found a temporary fix for the problem: Just put it in a markdown file and wrap the code block in javascript block comments like this:
Note I use ' instead of ` here because github really does not like nested codeblocks
/*
'''js
/*
<your snippts>
/*
'''
*/
EDIT: I actually really like this because I can have (one or many) unused snippet section like this:
/*
'''js
/*
<your snippts>
/*
'''
## Unused snippets:
'''js
<your unused snippets>
'''
*/
Very happy that #39 be implemented! Now I can use ultisnips in vim to quickly creat snippets :smile:.
However, current snippet file use a strange format (array in js?) , thus for syntax highlighting and checking to work, we have to write relevent configs from scrach, which is a REALLY pain...
I think it's better to switch to some more standard formats to solve that. Switch to
json
may only require minimal effort, though it appears to not support comments?I'm personally in favor of
toml
for it's readability and native support of comments. We may specify a snippet like this: