How to convert markdown link to item link

DT3 provides function to convert wikilinks to item link.
I was wondering how to convert markdown link ![xxx](image/xxx.png) to item link.

Sometimes I import image to markdown document through pasting and it generate a markdown syntax link, which is much much less powerful than item link. For example, if I change the name of the image, the link just become invalid.

Both links have their advantages. Item links are more reliable, relative links are more compatible to other apps. Currently DEVONthink chooses the link automatically depending on the location of the document and the image. We might add a preference to choose the preferred style.

:+1: Cann’t wait to see the new preference!

Is there a possibility to convert image links (assets/xyz.jpg) to item-links for whole markdown documents? I have searched in the forum here and in the manual, but haven’t found such a possibility.

No, that’s not possible.

maybe this could be a potential feature for the future… :wink:? technically DTP can identify the item link of a linked file, or am I wrong? thanks a lot for considering this feature suggestion.

Possible yes but no promises.

Scripting. Find all links in the MD, filter out those that are external or already item links. For the remaining links, find the records they refer to, get their item links and replace the links with them.

I posted code here that can be used as a starting point recently. It copies images referred to in a MD to the assets group and fixes the references accordingly.

Thank you for pointing this out. unfortunately I have no scripting skills :disappointed:

One can always learn :wink:
But I’m wondering why you’d want to do that. Item links do not work outside of DT, so previewing your MD file in any other app will not work. Is that really worth the easier removal of un-referenced images?

1 Like

I started with relative links and am now thinking to change to item links, as they provide higher flexibility within devonthink (moving images from assets folder to other groups, moving a MD file to another group, without having to think which images have to be moved together with it). Therefore, knowing that there is a possibility to convert item links to relative links and viceversa would be rather useful.

That’s already been determined. But I still don’t follow: Why don’t you simply use a group for each MD file with all its images, treating them like a package that stays together? Then you don’t have to think about

1 Like

as I have multiple MD files (annotation files) in one group and all their images in one single assets folder that is generated automatically from DTP when images are imported in MD files. Sometimes I have to move such a markdown file to another group.