Textualize / frogmouth

A Markdown browser for your terminal
https://www.textualize.io/
MIT License
2.35k stars 42 forks source link

Unable to open relative images / resources when md file is not in current dir #52

Closed jamescooke closed 1 year ago

jamescooke commented 1 year ago

Current behaviour

Frogmouth is not able to open resources relative to the current markdown file when that is not in the current directory. For example, for a file and image in a doc directory:

mkdir doc
curl https://placekitten.com/100/100 > doc/cat.png
cat > doc/README.md
# Hello

[Some image](cat.png)
frogmouth doc/README.md

Clicking on the "Some image" link brings up a "Does not exist" box:

Screenshot from 2023-05-27 23-19-45

Expected behaviour

Browser window opens with the image.

This behaviour happens when frogmouth runs in the doc directory, so it's able to open files when they're in the current dir.

cd doc
frogmouth README.md

However, when opening files by passing a file in a different directory, or using the navigation to load a file in an alternate directory, relative paths from markdown no longer work.

davep commented 1 year ago

Good catch! And thank you for the very clear report/reproduction steps too.

Bonus points for including kittens!

davep commented 1 year ago

53 should address this (looking good testing here). Will be in the next release.

Thanks again for raising this.

jamescooke commented 1 year ago

Thanks @davep - I've installed main and got the relatively linked images working in my local docs now 🎉

davep commented 1 year ago

Thanks for confirming. 🙂