Markdown-formatted image links w/ iCloud Drive

What I’m looking to do is use and iCloud Drive link for an image and use that in the traditional Markdown-formatted image links in a text editor, like [Image](link). Does anyone know if this is even possible? I’ve tried a couple of different methods to get the links: 1) getting the shared link out of iCloud Drive, and 2) using the FS Bookmarks method and appending the file name at the end. Neither of those seem to work.

Edit: to be clear, this is for taking the test, exporting to a PDF with a rendered image.

Putting it out there in case someone knows how to do this…

1 Like

@nahumck, I’m assuming that you want this for use in Drafts or is this more general purpose? i’m facing the same problem and haven’t found an elegant solution. everything I’ve found so far says I need to use the public web URL link which isn’t desirable.

The challenge here is not simply to get links, but, reading between the lines, to get renderable links. Let’s assume that this the case and it is for a preview. You have to have the image available via a web request when the preview resolves it. If you are able to login to a session, then you can do that and then view any previewed Markdown. But invariably you have to be using a full on browser implementation for that.

When developing on a desktop, a local web server is usually how this is dealt with. The same can be enabled on iPadOS, though not iOS. On an iPad, you can run apps in split screen, and there are many apps out there that can host files and serve them locally.

For example, in the past, I’ve tested this out running GoodReader and Drafts side-by-side. I’ve hosted image files in GoodReader (with the web serving feature enabled), copied the link, used that in my image markdown in Drafts, and have then been able to successfully preview the Markdown, including images in Drafts.

Prior to publishing I then used a Drafts action to find and replace for where the image files were eventually going to reside.

When publicly sharing an image file from iCloud, the resulting web page gives a download option, but not a simple link (like Dropbox), so I’m not sure there’s going to be a way to easily set such an image as an available online source directly. I can see a lot of Cloud Kit JavaScript code behind it, so while it may well be possible to extrapolate the link, I don’t think it’s a trivial step to do so.

Therefore, if this is not simply for preview, but for publishing, I would go with an invariably simpler approach of uploading the images to the final destination, and then updating if any revisions are required. That potentially takes out a lot of the issues outright; except if you are offline, in which case the preview option above is what I came up with as viable for such occasions.

Hope that helps.

It’s actually just for rendering a preview, then a PDF. How would I make that work?

From my experience on this one, it seems as though using temporary links in Dropbox is likely going to be the best option for me. I can work around this.

It’s dumbfounding to me that iCloud Drive hasn’t just replicated many of Dropbox’s features, especially with iOS.

Have you tried using the print to PDF trick from the preview?

Yes, I have. Just not sure how to get the iCloud Drive link to the image to make it work locally.

That’s where my earlier points and local web host alternative would come in.

What I think I’m going to continue to do:

  1. Use Shortcuts to save the image(s) to a temp folder on Dropbox and return the link(s).
  2. When saving the PDF (in this case for a daily journal), I’m going to include some steps to delete the files in the temp folder.

It’s not ideal, but it does work for my needs right now. I like the ideas you mention, but I’m not sure I want to install a different app just to serve this single function. I can do what I need to through Shortcuts already.

Sometimes the simplest implementation turns out to be the right one for the job. I’m not doing this often, so for the rare instances, I’m ok with it. Still wish that iCloud Drive did this, but I guess I’ll just wait and hope for future changes.