foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.44k stars 662 forks source link

Foam doesn't support the title attribute in images links #1262

Open junfx opened 1 year ago

junfx commented 1 year ago

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

riccardoferretti commented 1 year ago

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

BoudSTER commented 1 year ago

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

riccardoferretti commented 1 year ago

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]]

wdssmq commented 1 year ago

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

pic

riccardoferretti commented 1 year ago

Yup, good point, that's exactly the issue

meteorlin commented 7 months ago

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

riccardoferretti commented 7 months ago

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!