foam icon indicating copy to clipboard operation
foam copied to clipboard

Wikilinks, Links and tags inside (inline) code blocks should be ignored

Open ysl2 opened this issue 4 years ago • 3 comments

Describe the bug

If you define a inline-code '[[file2]]' in file1.md, and unfortunately there is a file file2.md in your repository, Foam will regard the inline-code as a link, and will appears in file2.md's "backlink" interface, this fake-link also can be opened

To Reproduce

You can reproduce it by folling these steps:

  1. Create a file file1.md
  2. Create a file file2.md
  3. Type these words in file1.md :
`[[file2]]`

Expected behavior '[[file2]]' will be regarded as a link, and a backlink in file2.md will appear in "backlink" interface

Screenshots

image image

Supplement:

After posting this issue, I tested the code-block, the result is same with inline-code, and if file2.md doesn't exist, Foam will create it.

I'm not sure if this is a bug or what you want, I mean, not "auto create file", but "inline-code/code blocks as a link". But what I can make sure is I can't open this fake-links in preview mode.

ysl2 avatar Nov 25 '20 02:11 ysl2

This is not currently managed by Foam itself, but https://github.com/kortina/vscode-markdown-notes. I am not sure whether the behavior is desired.

I agree that probably anything inside a code block or inline code block should not be included in the parsing of links/wikilinks (or tags for that matter, and I am pretty sure we currently include those).

riccardoferretti avatar Nov 25 '20 12:11 riccardoferretti

I also ran into this bug when I was writing c++ in code blocks. I found that '#include' or '#define' or other macro in c/c++ were recognized as tag marks. It is quite annoying.

My c++ code block is shown below. Screenshot_20210502_145102

And my tag panel which was 'polluted' by c/c++ macro is shown below. Screenshot_20210502_145004

Kcalb35 avatar May 02 '21 06:05 Kcalb35

I just did some quick testing to see if this was still a problem. I'm unable to reproduce the issue now that backlinks and tags are handled by Foam itself. I believe this issue can be closed

MCluck90 avatar Jan 02 '22 03:01 MCluck90

Yup this has been fixed a long time ago and forgot to close the issue :)

riccardoferretti avatar Nov 13 '22 22:11 riccardoferretti