foam icon indicating copy to clipboard operation
foam copied to clipboard

Foam doesn't support the title attribute in images links

Open junfx opened this issue 1 year ago • 7 comments

Describe the bug

I have the same issue, like https://github.com/foambubble/foam/issues/1200, with different cause. foam v0.24.0

![](/attachments/2021/2021-03-26-19-01-16.png)      show as a placeholder
![](a/b/c.jpg)                                      no such image, show as a placeholder
![](../../a/b/c.jpg)                                no such image, show as a placeholder
![](/attachments/foam-icon.png)                     show as a placeholder
![](../../attachments/2021/2021-03-26-19-01-16.png)   ok
![](../../attachments/foam-icon.png)                  ok

I guess we cannot use absolute style path for images.

My pasteImage settings:

  "pasteImage.path": "${projectRoot}/attachments/2023",
  "pasteImage.insertPattern": "${imageSyntaxPrefix}/${imageFilePath}${imageSyntaxSuffix}",
  "pasteImage.basePath": "${projectRoot}",

And it looks like treating non-markdown files as placeholders:

[](../../archive/cards/cant-allocate-memory.md)    ok
[](../.emacs)                                      file exists; show as a placeholder
[](../../.vscode/extensions.json)                  file exists; show as a placeholder

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

search show as a placeholder in issue's description.

Expected behavior

  1. if links an existed image/file, the "PLACEHOLDERS" session will not show them
  2. support abs path relative to project root?

Screenshots or Videos

image

Operating System Version

Windows 10

Visual Studio Code Version

1.74 and 1.80

Additional context

No response

junfx avatar Jul 21 '23 01:07 junfx

There are two issues here IMO:

  1. attachments needs to be explicitly added to Foam via the setting. At this point I believe this was the wrong call, and that attachments should all be included by default, giving people the option of excluding them as needed (e.g. via the foam.files.ignore setting)
  2. we don't support absolute links from the repo root. the convention we have so far is:
  • if the path starts with / it's considered to be absolute (at the system level, e.g. /Users/riccardo/hello.md)
  • if the path starts with ./ or ../ it's considered to be relative to the current file/context
  • if the path starts with anything else it's considered to be relative to the workspace root (e.g. journal/today.md)

Let's keep this task for n.2 and absolute/relatives paths. Feel free to create a new issue for n.1

riccardoferretti avatar Jul 21 '23 10:07 riccardoferretti

Hi,

I have the same issue and I didn't understand your answer.

Screenshot 2023-07-26 at 08 06 45 Screenshot 2023-07-26 at 08 08 28

Thank you in advance for your reply :)

BoudSTER

BoudSTER avatar Jul 26 '23 06:07 BoudSTER

Sorry, not sure I understand your question from the screenshot you provided, can you clarify?

As context, I should also mention that wikilinks embeds for images work, e.g. ![[my-image.png]]

riccardoferretti avatar Jul 27 '23 10:07 riccardoferretti

It seems that foam did not consider the possibility of the Title attribute appearing.

pic

wdssmq avatar Aug 10 '23 06:08 wdssmq

Yup, good point, that's exactly the issue

riccardoferretti avatar Aug 12 '23 16:08 riccardoferretti

Is there any progress on this issue? In addition, I also found that Foam treats the node's parent directory as a node that has not been created after executing Foam: show graph. image

It seems that Foam treats existed asset as node as well, even if the asset isn't linked in any markdown file (such as "nanoGPT.pptx" shown below). image

meteorlin avatar Mar 18 '24 14:03 meteorlin

No progress on this so far, it's not been super high on my list and nobody has taken it on.

Please file a separate bug report for anything else so it's easier to keep track of things, thanks!

riccardoferretti avatar Mar 18 '24 19:03 riccardoferretti