ITADN

`WikiLinkFollow` doesn’t resolve correctly for local files in some cases

#425Closedqadzek 创建于 2026-02-16
Q
qadzekcommented
In my wiki, I have a Markdown file and a picture. `WikiLinkFollow` works as expected for links to pictures in the inline `![label](URL)` format (with exclamation mark): they are opened in my image viewer. `WikiLinkShow` shows that these are correctly identified as type `md_fig` and are resolved to a local file. ```markdown Go to my relative ![picture](./balloons.jpg) now. <-- OK Go to my absolute ![picture](/home/qadzek/cloud/wiki/balloons.jpg) now. <-- OK Go to my absolute protocol ![picture](file:///home/qadzek/cloud/wiki/balloons.jpg) now. <-- OK ``` When using reference links, however, `WikiLinkFollow` only seems to work if the protocol and the absolute path is used. The following links are correctly identified as type `reference`, but resolving succeeds only for the last one. For the first two, it resolves to a `refbad` scheme: ```markdown Go to my relative ![picture][0] now. <-- FAIL Go to my absolute ![picture][1] now. <-- FAIL Go to my absolute protocol ![picture][2] now. <-- OK [0]: ./balloons.jpg [1]: /home/qadzek/cloud/wiki/balloons.jpg [2]: file:///home/qadzek/cloud/wiki//balloons.jpg ``` Hopefully you can reproduce this. This was first reported as an [issue](https://github.com/qadzek/link.vim/issues/23) in the `link.vim` repo. Thanks again for this beautiful plugin. --- Slightly unrelated, but while troubleshooting this issue, I also tested how other local files behaved, besides pictures. For example, a local audio file, using the `[label](URL)` syntax (without exclamation mark). For the first two inline links, `WikiLinkFollow` also behaved unexpectedly, as it didn’t open the file in my audio player, but created an `Example.ogg.md` file. I’m not sure if this is related to my settings though. ```markdown Listen to my relative [audio](./Example.ogg) now. <-- FAIL Listen to my absolute [audio](/home/qadzek/cloud/wiki/Example.ogg) now. <-- FAIL Listen to my absolute protocol [audio](file:///home/qadzek/cloud/wiki/Example.ogg) now. <-- OK Listen to my relative [audio][3] now. <-- FAIL Listen to my absolute [audio][4] now. <-- FAIL Listen to my absolute protocol [audio][5] now. <-- OK [3]: ./Example.ogg [4]: /home/qadzek/cloud/wiki/Example.ogg [5]: file:///home/qadzek/cloud/wiki/Example.ogg ```
关闭于 2026-03-08 5 条评论