Using linked images in markdown files

I’m trying to write a markdown file in DEVONthink (Pro Office 2.7.7 if it matters) that has images in it. I have the images saved in another group in the same database as the markdown file, and am attempting to use the markdown syntax for images ```


I've tried to get the URL for the image using either right-click Copy Item Link (ex: x-devonthink-item://2A7B1030-1C38-4E86-8E2C-7B7B9A0F1A6F) or Get Info: Path (ex: ./jpg/3/demo.jpg) but neither option seems to work. Rather, the preview within DEVONthink shows a broken image URL.

Any suggestions? I've gone through all the documentation on markdown files in DEVONthink, and it's pretty sparse. There's nothing about using images in markdown that I could find.

Right now only remote URLs (http, https) and file URLs are supported. The path shown in the Info panel is abbreviated in case of internal items and therefore relative to the database package. You might use this script to get the full path:


tell application id "DNtp"
	return path of item 1 of (selection as list)
end tell

With the new versions of DTPO and DTTG, are remote URL’s still the only way to link to images stored within Devonthink while editing an external markdown document?

Or can we link using the DT item URL, like this?


 ![Image Name](x-devonthink-item://2FEC90B8-A15C-4B59-8638-A69D8A818537)

Or has the system been updated with the new versions? Thank you.

Yes, it’s already implemented. Also, local links are supported.

(And ignore the typo in my filename - :mrgreen: )

Thank you for your response.

Linking images with the DT Item URL is great until you send it to another place (like Marked 2 for preview/export).

It’s possible I’m doing something wrong, but has anyone had any success with viewing the image outside of DTP?

Thanks!

The only workaround would be to use relative links and to index the Markdown documents instead of importing them. That way the relative link is valid outside of DEVONthink.

@BLUEFROG I use the DT item URL in a markdown document. I found out DT and DTTG do not handle PNG files properly. For testing, I created a markdown document with two separate DT item URL to a PNG file and JPEG file. Both file are actually the same picture. Just in different format.

Or is there any special consideration I need to take note when linking a PNG file?

IMG-PNG

IMG-JPEG

Is this definitely a PNG image? Because PNG is fully supported by the WebKit and therefore the HTML-based preview of Markdown documents.

Yes. Definitely. In fact, I have many such photo examples taken by iPhone, in PNG format, are having this problem.

If needed, I can send you the PNG file for your investigation.

Yes, please send such a picture to cgrunenberg - at - devon-technologies.com - thank you!

As @cgrunenberg noted, PNG is definitely supported.

The top image here is a PNG file I just downloaded and added.

@cgrunenberg I have emailed you the PNG file.

@BLUEFROG I wasn’t clear when I said DT and DTTG do not handle PNG files properly. For some PNG files, like what is in your example, it displays well. For some PNG files, in my example, it does not displayed. The PNG files that has problem usually are the larger picture size or file size.

But for JPEG files, it can handle all picture size or file size.

Thank you! It’s actually a HEIF image according to the info shown in Preview.app.

As the OP said: they have many such images taken with an iPhone. Which, as far as I know, never took png images.

I was thinking it may be HEIF or HEIC.

You are right. When it is viewed in Preview app, the inspector show it is a HEIF image.

I thought it was a PNG file because DT inspector show it is a PNG image Kind. And DTTG also show it is a PNG image.

I take a look at the photos created by iPhone. They are mostly HEIF images.

I would like to take a photo using the iPhone. Create a Markdown note to link the image in DTTG. Thereafter, I can do more writing later in DT of what I captured. In fact, I use the shortcuts in this blog.

How can I do that now that HEIF images is not supported?

You could change the settings for your iPhone so that it saves images as jpeg again. Google knows how, I think.

Got it. Thanks. :grinning:

As an aside: this is probably not related to DT at all. I think DT uses WebKit to preview markdown. And WebKit does not support HEIC. Though both are (mostly) Apple products.