Things I have tried
The standard google search, I found a plug in called inline-variables but I couldn’t get it to work.
I’ve also tried
= this.variable but where I need it stops it being run.
What I’m trying to do
I’ve been updating my obsidian set up recently and now have some nice self-reporting templates. But I am missing something that would make my life just a little easier.
Essentially one of my work roles requires a series of commands and text being input into a system manually. So I thought instead of repeatedly copy-pasting a name into a dozen places, I could have one variable in the yaml that can be referred to through out a page. Something like…
variable = Phorcus lineatus
otherone = projectname
= (this.otherone + '_' + this.variable)
So far this works as long as it is outside of the code block (
) but this would introduce spaces that break the code.
I hope that explains it properly.
Thanks in advance for the help.
What spaces? The “Phorcus lineatus” space?
Not that one no, that will be expected. Writing the code in a way that allows the data view snippets to work would introduce large spaces between the lines.
In this case:
code code code
Although it would work, introduces newline and space characters.
codecodecode`= this.variable`code code code
generates literally that as a string. But ultimately is the format I want and need.
ok, I get it. I don’t see any solution for that, but if you want to differentiate (visually) the code part you can use the admonition plugin.
Ah i hadn’t heard of admonition before, this works pretty much perfectly. Thanks for the help.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.