Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to embed local images #18

Open
dgsmith opened this issue Mar 3, 2016 · 6 comments
Open

Unable to embed local images #18

dgsmith opened this issue Mar 3, 2016 · 6 comments
Milestone

Comments

@dgsmith
Copy link

dgsmith commented Mar 3, 2016

I've got a very simple Markdown file to test this out that just has ![test image](md_assets/tank1.png) in it. I put the file tank1.png in a folder called md_assets in the same directory as this test.md file. I then open with Markoff and I see...

tank image fails to load

Then, I use Markdown Preview in my Sublime Text editor and see...

tank image successfully loaded

Not sure if this is fixed by switching to SwiftMark...but I've installed the latest version from the App Store and am seeing this problem. Thanks!

edit: worth noting that I am able to load external images, and I have tried using the full path to my image.

@kaishin
Copy link
Owner

kaishin commented Mar 5, 2016

Thanks for reporting. This is a duplicate of #2.

@kaishin
Copy link
Owner

kaishin commented Apr 1, 2016

I was unable to figure out a clean of way of doing this in a sandboxed application. If anyone has any suggestions I'd be happy to take them.

@pch
Copy link

pch commented Jul 4, 2016

Hit the same issue today with local images... I don't know anything about Cocoa, but maybe a solution would be to change the current working directory to the Markdown file directory when preview is triggered? Maybe then relative paths would render fine, but that's not a very educated guess.

@blezek
Copy link

blezek commented Oct 10, 2017

See this has been idle for a while, but Markoff could detect that opening an image falied and ask the user for permission on the enclosing folder. The Unarchiver does this for the Downloads directory the first time it is run. See https://stackoverflow.com/questions/12771375/what-does-a-mac-sandboxed-app-get-access-to-when-the-user-selects-a-folder

Side note: just stumbled across Markoff and it's exactly what I want in a previewer. Hoping this can be fixed.

@mitnk
Copy link

mitnk commented May 24, 2019

Though not perfect, I'm using this way to solve the problem:

  1. Organize all md files under one root dir, e.g. /home/mitnk/docs/

  2. Always run a http server (using python etc) under this dir.

nohup python3 -m http.server -b 127.0.0.1 -d /home/mitnk/docs 9901 > /dev/null &

Use a fixed port and remember it. Use nohup here so that we can close terminal without terminate the http server.

  1. Drafting doc in one of sub dir, e.g. /home/mitnk/docs/design/foobar.md

  2. Drop your images under some sub dir, say docs/design/img/001-logo.png

  3. Now we can insert your image into foobar.md file like this:

![img](http://127.0.0.1:9901/desgin/img/001-logo.png)

or control the image size with raw html:

<img src="http://127.0.0.1:9901/desgin/img/001-logo.png", width="200">

Should work with Markoff now. (Yes, this way I've replaced Evernote with Dropbox/git :-)

@kaishin kaishin added this to the 3.0 milestone Jul 8, 2020
@kaishin
Copy link
Owner

kaishin commented Jul 8, 2020

As I am starting work on 2.0 and 3.0, I have been thinking about this. I still haven't figured a proper solution but I've got some ideas. Stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants