0

I have a file which embeds an image

![](file://tmp.jpg)

I have added iimage mode to the markdown mode hook and even added recenter to it

(add-hook 'markdown-mode-hook 'iimage-mode)
(add-hook 'markdown-mode-hook 'iimage-recenter)

However when I open the file the image is not loaded automatically. I have to manually run the iimage-recenter command inside the buffer before the image is actually loaded. in the buffer. Any suggestions how I can specify to run iimage-recenter after a particular file is loaded. I am guessing I'll have to edit some hook (maybe after-insert-file-functions?), but not sure which one.

3
  • iimage-mode is incompatible with markdown-mode. iimage-mode just uses the display property to display paths as images while markdown-mode has the display property in its value for the variable font-lock-extra-managed-props. So font-lock removes the display properties set by iimage-mode immediately when it (re)fontifies (parts of) the buffer. Even if you have a fast hack to temporarily display images with iimage those images will be removed by font-lock when you edit text near the image or if the image is in a part of the buffer that is not yet rendered by font-lock.
    – Tobias
    Aug 12, 2019 at 11:49
  • 3
    Note that markdown-mode has a command markdown-toggle-inline-images that does almost what you want. The style of the link is a bit different. The command expects the file name without url schema, i.e., ![](tmp.jpg). If you adapt to that convention you can just add 'markdown-toggle-inline-images to markdown-mode-hook.
    – Tobias
    Aug 12, 2019 at 12:02
  • Thank you, this is exactly what I needed.
    – Pushpendre
    Aug 13, 2019 at 6:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.