This doesn’t have much to do with Obsidian and much more to do with
Tonight after a lot of efforts and Googling I was able to create a script for Linux users who have complete Latex installation (Tex Live would work too)
I have done a “OK” job of explaining how the script works in the script itself, if you don’t understand it, unfortunately, I can’t help you with it (sorry, no time). I would suggest you to seek help from Bing ChatGPT4 or Bard or other members in this community. I have attached two videos which further help explain the working of this script.
I could not make this (obsidian-latex-render github package) work, but if you can make this plugin work, well, it’s better than the work around I have found here. I am pretty sure it can be improved, but what the H, I don’t have that kinda time right now. If someone wants to improve this script and perhaps try to comment it here, please feel free to copy, redistribute and modify, I own no rights on this (in fact, it’s embarrassing to even talk about it for this small not so complicated script)
#!/bin/bash #opens the example.tex file which would be later used to create the svg image. featherpad example.tex #this uses the latex which is installed on linux to convert the example.tex file in the previous file to .dvi and .svg files. I know there is no svg command here, but it does create it latex -interaction=nonstopmode -halt-on-error -shell-escape "/home/$USER/example.tex" && dvisvgm --exact --font-format=woff2 "/home/$USER/example.dvi" #file_path is the path where I want to save the .svg files file_path="/home/$USER/Documents/DO_NOT_DELETE/$(date +%Y-%m-%d_%H-%M-%S).svg" #file_name is useful while creating the image "command" pasting which would attach the svg image to obsidian file_name="DO_NOT_DELETE/$(date +%Y-%m-%d_%H-%M-%S).svg" #.svg file created would have been saved in $USER folder, this command will move it to the documents folder. mv example.svg "$file_path" #this will give us the text pasting in obsidian would give us an embedded image echo "![[$file_name]]" | xclip -selection c #shit to know about this script #every file created is different (as long as you don't create it within 1 second) #every file is moved to the $file_path you specify #file_name is to shorten the file_name. i.e., if you paste the full link to the image inside of ![] it would give you an error. # #I have explained more about it in the video I have attached exit 0
The need for variable
Again, I am really tired, sorry for the bad quality of the video