How to use of some custom dataview variables in code block?

When using variables in block code, I don’t get values ​​in view mode. Please tell me how can I fix this?

View mode

You do not need the full 3-backtick codeblock to make those appear in view mode. Just the single backticks is enough.
Does that solve your problem, or do you need that in a codeblock for some reason? Could you replace the codeblock with e.g. a callout?

I need a button to copy to clipboard so I put it in a codeblock. I tried using Admonition and it solves the problem but sometimes it doesn’t look as compact as it seems to me


And when using codeblock it looks more compact and nicer in my opinion

1 Like

Hi, has there been any update on this? I really want to use dataview variables within code blocks to make dynamically changing notes.

There is an alternative to make these using dataviewjs, but it becomes very cumbersome and lengthy just to do something very simple. It would be great if there was some specific syntax to get yaml variables inside a codeblock!

Dynamic code blocks with variables: Input

Dynamic code blocks with variables: Output

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.