I have tried searching Obsidian and reddit forum, as thought one of the hotkey plugins might have what I am looking for, but no success yet.
What I’m trying to do
I am documenting some MATLAB code using codeblocks (```) for script, with images and further explanation between each block.
The ‘Editor Syntax Highlight’ plugin, supports Octave highlighting in edit mode, but sadly not in display view. The built-in syntax highlighting is the opposite showing highlighting using ```matlab in display view but not edit mode. Neither of them are amazing (presumably due to MATLAB being less open / popular than python etc), but it is still fairly helpful so a workaround would be working with ```octave and then replacing all blocks to ```matlab at the end.
Question: Is there a way I can create a custom command or key shortcut to find and replace all occurences of a particular word. In my case, a command that replaces ```octave with ```matlab for all occurences in the file?
Use the Hotkeys for Templates plugin to bind such a template to a keyboard shortcut.
In the meantime, Obsidian does have a conventional find-and-replace feature.
I will also need to delete existing content before replacing with updated, but couldn’t even get this first step working. Console returns: Template parsing error, aborting. missing ) after argument list
If anyone here can assist that would be appreciated! Thanks!
You’re actually pretty close, but you still need to use Obsidian API functions to manipulate the contents of the doc—return won’t do it because Templater doesn’t actually do anything with the returned output.
I don’t have the time to edit your code right this second, but I’ve done something similar with this. You might be able to use what’s in there to fix what you’ve done already.