Syntax to resize markdown images in Devonthink preview

Hi all

I wonder if one can use a DT/common MD syntax to resize images in markdown preview mode

ie for a link like

 ![CleanShot 2022-05-30 at 21.05.04](assets/CleanShot%202022-05-30%20at%2021.05.04.png) 

can one specify a min/max size?

@BLUEFROG , this time I did read the help file in depth but couldn’t find references to that in the markdown section :slight_smile: :slight_smile:

thx a bunch

Z

You probably have to do that in a CSS file/inline. MMD does not allow for classes to be added to its elements, afaik.

Thanks for trying beforehand :smiley:

@chrillek is correct in that this would be handled via styling, e.g,…

img {
width: 150px;
height:auto;
}

gotcha in that case…can I put a feature request for adding in link resize like in obsidian ie:

# MD
![AltText|100x100](https://url/to/image.png)
# or 
![[image.png|100x100]]

thx!

Z

2 Likes

I don’t think that’s a good idea. Firstly, I guess that these dimensionless values are meant to be in pixels. Which is not a sensible choice for sizes nowadays: while 100 pixels are a third of the screen width on an iPhone, they’re only about an eighth on an ipad and even less on the desktop. Why wouldn’t I want to see the image larger on a larger screen?
Secondly, such a modification breaks compatibility. Markdown is already fractured enough as it is. Introducing another “feature” is not helping.
Thirdly, the solution is already there, and it is called CSS.

2 Likes

There’s also an option in Preferences > Editing to scale images automatically, this is applied to Markdown & rich text documents and formatted notes.

1 Like

This does work in DT for resizing images:

[image-with-attributes]: logo.png “For this image, the height and width are specified” height=22px width=60px

Actually, this method would be for resizing specific images, not a global styling of all images.

The request is noted but that is non-standard behavior.

Note this useful trick:

<img src=“x-devonthink-item://40C41285-D0D3-484C-9946-AB2BF53B031E” width=“500” style=“float:right”>

width=“xxxx” … sets the size with xxxx pixels
style=“float:yyyy” … sets the float as “center, right, left” … cent is text above and below, right text is left of image, left text is right of image.

There is no center for float. And it has always been possible to use HTML in Markdown.

Ok - then show the examples. Please

Examples for what? If you’re looking for documentation on float, head over to MDN:

If you’re looking for ways to style MD documents, see here:

1 Like

I would second this.

I just found that some other MD-syntax of Obsidian is explicitly re-used in DT.
(Help-Document on transclusion: “It also supports the Obsidian syntax, e.g., ![[Chapter 2.md]].”)

So, I would second @zeltak ´s request to do likewise around image re-sizing, as this would very much uncomplicated shared use of resized images in some interoperability scenarios (not only Obsidian, but including it).

Thanks for noting.

Just a thought, this may work in a more responsive manner if the image sizing unit was based on percentages of the window width instead of being explicit pixels.

1 Like

Thx for sharing & contribuing that attentive thought.

I’d also prefer that – in theory.

As far as I am aware, Obsidian-style resizing (or any MD-flavor allowing for this pipe-syntax, like Tangent Notes) only deals in pixels, and not in percentages.

What it does allow is specifying only width value.

As much as I’d love that, the more central motivation is to strengthen interoperability btw different venerable Markdown-capable apps in such a central aspect as controlling image size (and thus a modest form of ‘layout’).

My understanding is that this was also the motif to allow for particular way that Obsidian syntaxes transclusion in DT.

1 Like

Thanks BlueFrog. That is perfect. As nearly always, Devonthink has all that you want and more, you just need to find the answer in the forums or docs…:heart:

1 Like

You’re very welcome :slight_smile:

1 Like