secure-77 / Perlite

A web-based markdown viewer optimized for Obsidian

Home Page:https://perlite.secure77.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attachments are loaded if in the root folder, otherwise ignored

knikhil42 opened this issue · comments

attachments are loaded if in the root folder, otherwise ignored

Screenshot 2023-02-18 at 12 42 11 PM

Screenshot 2023-02-18 at 12 41 53 PM

Screenshot 2023-02-18 at 12 42 26 PM

I copied one file to the root and added a link to it the .md file, it worked but the relative one didn't

Screenshot 2023-02-18 at 12 45 37 PM

again, there is a workaround, scripting files to move files from files inside to the root folder and and updating links

commented

I need to test this but at least loading from a subfolder should work without any problems in my personal note I have all my images always in a subfolder of my current folder and this is working. Maybe there is an issue if the image is on a complete different path.

Also having the same issue. Running the docker compose container system, and images in a separate folder (assets/image.jpg) are not loaded in. They do not appear in perlite nor in the files where they are linked.

EDIT: to be clear, the setup is the same as you describe; a subfolder of the folder where the file with the reference lives

So I played around with this a bit and figured out what causes the break.

The standard wikilinks-style shortcut for inserting an image, which you use in the demo repo, is e.g.

![[../assets/myimage.jpg]]

This works as expected even with relative file paths as above. However, obsidian prefers markdown-style syntax for images, which would refer the same image with optional alt text as follows:

![This is my image](../assets/myimage.jpg)

The latter syntax breaks image insertion in perlite and leads to a dead link, as it's attempting to resolve it as an http link

commented

So I played around with this a bit and figured out what causes the break.

The standard wikilinks-style shortcut for inserting an image, which you use in the demo repo, is e.g.

![[../assets/myimage.jpg]]

This works as expected even with relative file paths as above. However, obsidian prefers markdown-style syntax for images, which would refer the same image with optional alt text as follows:

![This is my image](../assets/myimage.jpg)

The latter syntax breaks image insertion in perlite and leads to a dead link, as it's attempting to resolve it as an http link

yes, "normal" markdown links are not supported, this is also the case for links to other files. You can change this setting in obsidian, see also the requirements

Okay, good to know. It might be good to add clarification on supported link types on the documentation then. Are footnotes also not supported?

EDIT: Also realized that my issue with unsupported markdown links is not the issue OP is dealing with, so I'm of no help there

Could this be from a pathing error? In the picture OP shared of the image not loading that pathing is for if the file loading the image in the root folder, notes in their case. However if the file trying to display the image is in a different location it would only look down with that pathing. It would need to go back to the root of the notes directory to load the image correctly.

commented

Yes, I think the problem is that obsidian doesn't create relative paths for attachments, for internal links you can change it in the settings but for attachments it seems not to work, I will take close look to this soon but for the moment It seems attachments must be resident in the same or a subfolder for the current note location

if you have the setting of "New link format" to relative path to file, and have Automatically update internal links turned on. It seems to work for attachments. almost weekly I add new photos to my notes and move them around and they load just fine in the latest release of perlite.

commented

I could figure it out, there are two different situation and behaviors.

you can place a attachment in any directory you want and also move the attachment around. The link to the attachment should be then updated in you notes file and you will get a relative file path to the attachment, for example like this
![[../../BASIC Tool Set/Pasted image 20211101013816.png]]

the problem is when you move your notes file, then the path to the attachment will not be updated and will stay the same, in this case perlite can´t find the attachment anymore.

unfortunately I cant find any setting in perlite to auto update the path to the attachment after moving the file, so the only way to fix this, is then also move the attachment one time (to any directory you want) to get the link updated.

I will close this issue as I cant fix it and will add this to the wiki