The following macro:
It will let you to just type:
but when the block is not in edit mode Logseq will just render it like you wrote:
this macro makes much sense if you use a lot of PNG images and you want to get rid of the
.png too; you can define other macros for other formats.
Same with assets in different folders
In case you place assets in folders other than
/assets you can mention them in the macros:
"course" "!(../courses/$1.mp4)" "drawing" "!(../images/drawings/$1.jpg)"
and eventually if you decide to edit the folder structure of your assets you just need to edit the macros definitions and not to edit all your Markdown files.
Refer assets to current page
Let’s say you have many pages with (numbered) images and you want to keep them organized in folders.
If for example you create for each page a folder like this (including
then you can use a macro like this one:
"current" "!(../assets/<%current page%>/$1)"
so that something like this:
will render different images according to the page it is placed in.