Can Markdown Preview show local images?


#1

Is it possible to use local images (iCloud Files, Dropbox, other?) in Drafts so that the Markdown Preview action shows the image in the preview? For example, if image 1234.jpg exists in the Drafts folder in Files, then something like this in Markdown to render an image in preview:

![Local Image](\images\1234.jpg)

I know we can access local files in iCloud Files with the FileManager object, just curious if there is a way to preview images with Markdown too.


#2

Unfortunately not. How would you address them as there isn’t a file store as such? (Unlike Editorial, which maps part of Dropbox.)


#3

I was thinking it could assume the Drafts folder was the top level folder in the Files app like it does for the FileManager action with Javascript (reference). I know we can read files from that location, would just be cool if we could show images from it too.


#4

I’m not necessarily recommending the approach, but…

If you had an action that processes the Markdown, reads in the image placeholders, then reads in the corresponding file, converts it into base 64, substitutes that as base64 image HTML back into the Markdown for the corresponding image, then converts that whole Markdown content into HTML and then previews that. I think that might technically work.


#5

Drafts can only use the hosted image links (Dropbox, iCD, etc) as far as I know.


#6

This approach has been in the back of my mind…terrifying and taunting me. I see that we have the same nightmares. :slight_smile:


#7

This is the only reason I still have Bear on my phone. :(:tired_face: