Thanks @ryanjamurphy. I had a look at Templater and believe this is the way to go for now.
Sadly, I have never touched Javascript. I tried the below with no success.
oct2mat.js (js file in TemplaterJS folder)
function oct2mat(tp) {
string=tp.file.content;
string.replace(```octave, ```matlab);
string.replace(``` octave, ``` matlab);
return string;
}
oct2mat_syn (Template in tempate folder)
<% tp.user.oct2mat(tp) %>
<% tp.file.cursor(1) %>
<% tp.file.cursor_append(string) %>
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!