Any way to get variables' value in custom commands?

Nice try, and the idea about macros. But if could use <%current page%> then can actually use it in Logseq system template, which supports <%current page%> too.
The point is, <%current page%> always returns a string with a double square bracket [[ ]], this will be included in search parameter and make it wrong, need take time to manually carefully adjust it.

About the space, you can add [ ]( ) to avoid it.

E.g. a compromise, right now I use logseq-powerblocks-plugin by @hkgnp , create a powerblock template in a page, like this:

- wiki #powerblocks
	- [<%CURRENTPAGENAME%> - Wikipedia](https://zh.wikipedia.org/wiki/<%CURRENTPAGENAME%>)

For now it can be used by typing /insert powerblock, for more instinctively use I copy its button renderer to custom command in config.edn:

 :commands
 [    ["wiki" "{{renderer :powerblocks_, wiki}}"]    ]

Now if you type /wiki anywhere then Enter, it will pop up a white “powerblock button”, then click it manually, it will return a link in format []() and it can handle the spaces correctly.

It’s a compromise way, still, expecting a native way to solve this.

1 Like