benjypng / logseq-localassets-plugin

MIT License
34 stars 8 forks source link

Delayed translation of the path? #2

Closed emms007 closed 2 years ago

emms007 commented 2 years ago

Hello,

Thanks for your plugin, it works pretty good. I use it to publish Telegram content to Logseq script.

It seems logseq-localassets-plugin translates the {{render}} instructions when it parse the .md file for the first time, so "../asset/zzz.jpg" becomes "c:\logseq\zzz.jpg". Following this first time, the conversion is saved in the the .md file, ie containing now the full path. This kills any chance to have a different path that would be applicable to other devices running the same Logseq schema.

See the scenario of the PC translating to "c:\logseq\zzz.jpg" and this will fail to render a phone later on.

Is there any chance that the conversion of {{render}} is not saving the full path in the file, but rather calculates it upon every rendering context?

benjypng commented 2 years ago

@emms007, thanks for bringing this up!

Basically, only assets that can use the ![filename](../assets/filename) syntax would be able to be "transferrable" across other computers. This means only PDFs (non-inline), images & external docs.

For all the other uses, e.g. inline PDFs, audio & video, Logseq doesn't support the above syntax. For example, for audio controls, the syntax [:audio {:controls true :src "../assets/test.mp3"}] will not work.

I've since updated the release to support transferability for images, external docs and PDFs (non-inline). But do note that for the other file types, there would be no transferability.

Thanks again for your inputs!