Markdown images do not update after resizing them?

  1. I have a Markdown document with an image in a local folder/group.
  2. I find the image is too large, so I open the image in Preview and resize it.
  3. The preview of the Markdown doc still shows the image with its previous too large dimensions, it will not update! Even after switching Source/Preview it will not update!
  4. The ONLY way to make it update seems to be to rename the image and then change the source code accordingly! However, if I change back to the old name, DevonThink appears to have cached the image so it will show the old too-large image before it was downscaled!

There must be a better way to make it “refresh” the preview so it respects the changed image! The refresh should be automatic, but I can live also with a manual refresh.

Have I missed something or is this a bug?

1 Like

Does emptying the cache (see DEVONthink 3 menu) make a difference?

No it doesn’t!

But restarting the app does fix it (without having to rename the image)?

1 Like

Yes it does!

How does the source of the document look like?

![Image 2022-09-19 100247](_Assets/Image%202022-09-19.png)

This seems to be a WebKit caching issue. Which macOS version do you use?

macOS 12.5

Why don’t you just using CSS styling to display the image at a different size, e.g,…

img {
width: 80vw;
height: auto;
1 Like

Because I don’t want ALL images that size!

If I could do it in the MD doc (without full html code of course) it would be acceptable.

Ideally, I would want to scale down the image (perhaps even ALL images) a factor of 2, but there is no such thing in CSS as far as I know – only % relative containing box (i.e size of the column or div).

Related to the above:

macOS development in Xcode has used a naming scheme where image filenames ending in @2x are rendered as high resolution images on retina displays. This is the same as a website image of say 200x200 px sized in html as:

<img src="image200x200.jpg" width="100" height="100" />

The result is a razor sharp image rendered on screen in high resolution for retina displays.
I have used that a lot for several web pages.

Something similar would be desirable also for images in DevonThink Markdown notes.

Hoping that the browser (and DTs preview is just that) keeps an image at the exact pixel size you store it with might result in disappointment.

How the image appears depends very much on context (container, position, sizing). Your best bet is to use CSS to determine as many parameters as possible.

And keep in mind that MD is not HTML (nor is it meant to be). So trying to control all aspects of MD rendered as HTML is futile. If you need that, you’re better off with HTML.

What Apple does in Xcode, it’s neither here nor there – DT uses MultiMarkdown and is limited to its possibilities. You could try to abuse the image link by appending something like #small
and write CSS that works with that. No idea, if that would work or not here. Alternatively, you could abuse the alt or title parts of the image link in MD.


FYI: My alternative to MD is absolutely not HTML (or FrameMaker, or InDesign, or Pages or …) since I don’t use Devon to create documents to be published – I use it as a database of notes and documentation. So speed and convenience of editing is paramount, while at the same time being reasonably nice to read on macOS and iOS.

The alternative is to continue to use RTFD, which I have used for many many years and I have many hundreds of those. In RTFD, I can change the size of an image by double-clicking the image and change the DPI value. And I can add some annotation or draw a circle or something similar. Very simple and reasonably fast. That won’t work with MD of course, and there are no other ways to change the image, apart from resizing the pixel count, and then restart the whole DevonThink to refresh the preview! Or fiddling with tedious CSS hacks abusing Alt text etc for individual small images of different sizes copied from the net – that is not a realistic option for something that is intended as notes.

I have for some time experimented with MD since it does have many merits to create reasonably structured and consistent content with several formatting aspects automated by CSS (and it is at least somewhat WYSIWYG for the most basic primitive uses). I have fiddled considerably with CSS to make it nice and flexible for different kinds of uses for various notes. But images are definitely an obstacle! One can use a DIV tag with a class specification for certain uses, but it will be very tedious if it is overused.

I am not 100% sure I will totally switch to MD, but I have a few docs where I use it. The need to restart Devon just to refresh the preview is definitely a negative aspect. Another negative and annoying aspect is that the preview window (in side-by-side view) will not scroll automatically showing the part I am editing, and conversely, scrolling the preview will not scroll the source to make it easy to quickly make changes to what I see in the preview. But this is off-topic.