.md image size control

When I “copy item link” and paste it into a .md document the result is:
[item name](x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29)

If I drag&drop it I get:
![item name](x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29)

But I would like to just copy/paste the “x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29” without the identifier

so that I can then paste it into

<img src=" " height="100">

such as:

<img src="x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29 " height="100">

This is so that I can control the size of the image, otherwise the .md shows the image at the size that was captured.

  1. How can I just capture the x-devonthink-item:ID and nothing else (without the item name)?
  2. Is there an inspector where I can just look/copy the x-devonthink-item:ID?
  3. Can I create a ‘custom metadata’ field to show/copy the x-devonthink-item:ID?
  4. Is there a KeyboardMaestro or BetterTouchTool macro that can just let me copy the x-devonthink-item:ID already formatted with the <img src=" " height="100">?

“controlling” image size without context is not a good idea. If you want to do that, you should specify height and width attributes and read up about them, They’re not (anymore) what you probably think they are.

Context menu for the image

Sure. But you have to somehow™ set this metadata field.

Also: Why would you want to style an HTML img element directly in your MD file instead of using style sheet? That would also permit you to use relative units (instead of the implied pixels in your height attribute) like 50% or 10rem or whatever. Anything is better than absolute pixel values, because pixels come in different sizes depending on the current device.

Just copy the item link via Edit > Copy Item Link or the contextual menu instead of dragging and dropping.

  1. Can I create a ‘custom metadata’ field to show/copy the x-devonthink-item:ID?

No because you’d need to populate the field manually. Adding a custom metadata attribute doesn’t populate itsrlf.

And where’s little snippet for a quick HTML link of a selected image…

tell application id "DNtp"
	set sel to (item 1 of (selected records))
	if (type of sel = picture) then
		set imgLink to ("<img src=\"" & (reference URL of sel) & "\">")
		set the clipboard to imgLink
	end if
end tell

thank you @chrillek
Re: Context menu

“When you Control-click in the contents of documents, you will see a contextual menu with commands and options.” The option “copy item link” will paste [item name](x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29). I don’t want to
paste the item name.

Re: Why would you want to style an HTML img element directly in your MD file instead of using style sheet?

Because that allows me to control the size of each image in the document preview. I don’t have much space in my laptop screen, so I need to see the images as best that I can for my research. This is for internal research and will not be published, so I am more concerned about my ability to see images correctly (specially not blow up outside of the window). I just want to screen capture an image, paste it into the .md and tweak the size.

Thank you @BLUEFROG
“Just copy the item link via Edit > Copy Item Link or the contextual menu instead of dragging and dropping.”

The option “copy item link” will paste [item name](x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29). I don’t want to paste the item name into the .md, as a matter of fact, I don’t even want to paste the parenthesis. I just want: x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29

Pasting where?

Into an .md document

so that I can then paste it into

<img src=" " height="100">

such as:

<img src="x-devonthink-item://02E4AE1D-C054-4CCE-9DD6-B5D1FC301B29 " height="100">

A Markdown document where?

If I copy the item link via the contextual menu and paste into a Markdown document in DEVONthink, it only pastes the reference URL. :thinking:

I have a file, a screenshot, titled: Screen Shot 2022-02-20 at 09.58.02.png
Select with Control Click > Copy Item Link
Paste into body of .md, results: [Screen Shot 2022-02-20 at 09.58.02.png](x-devonthink-item://4A0DBBDD-3DF0-4018-8FEA-69084D30B0B6)

Ahh… gotcha.

There is a hidden preference for pasting raw text. I see what you mean now. Thanks for the follow-up and yes, I see this too.

  • You can use Edit > Paste & Match Style to paste just the reference URL.
  • You can click the On link for Help > Documentation > Appendix > Hidden Preferences > RawMarkdownPasting. However, this is a global setting for all pastes into Markdown docs. (I had this enabled.)

Thank you @BLUEFROG

Pasted this in to Terminal:
$ defaults write com.devon-technologies.think3 RawMarkdownPasting on

Returned:
zsh: command not found: $

without the $

1 Like

Thank you @chrillek That seemed to work since it did not return anything.
Note that the examples shown on the Hidden Preferences document show the $.
For us ‘walk-by-the-hand’ (aka: trip-on-your-own-feet) persons, the exclusion of the $ should be noted on the document.

Why didn’t you merely click the On link ?

Or in Monterey, Control-click the On link and choose Copy Link, then paste that into Safari’s address bar?

:thinking:

Did click ON in the Hidden Preferences document. There was no feedback of any kind (the link did not go anywhere or seem to change anything) so I thought that the process was to go through Terminal.